Skip to content

Commit

Permalink
rimage: Limit input module count to module array size
Browse files Browse the repository at this point in the history
Added limit of a number of input modules provided in a command line to the
maximum number of supported modules (size of module array / MAX_MODULES)

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
  • Loading branch information
softwarecki committed Nov 27, 2023
1 parent 383d17a commit 36b2f68
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/rimage/src/rimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,12 @@ int main(int argc, char *argv[])
goto out;
}

if (image.num_modules > MAX_MODULES) {
fprintf(stderr, "error: Too many input modules\n");
ret = -EMFILE;
goto out;
}

/* Some platforms dont have modules configuration in toml file */
if (image.adsp->modules && image.num_modules > image.adsp->modules->mod_man_count) {
fprintf(stderr, "error: Each ELF input module requires entry in toml file.\n");
Expand Down

0 comments on commit 36b2f68

Please sign in to comment.