Skip to content

Commit acd2564

Browse files
committed
drc: validate config blob size before use
DRC setup dereferenced the config blob as a fixed struct without verifying the blob was at least that large, over-reading adjacent heap for a short blob. Require the blob to cover the config struct. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent 40dc147 commit acd2564

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/audio/drc/drc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,10 @@ static int drc_prepare(struct processing_module *mod,
353353
/* Initialize DRC */
354354
comp_info(dev, "source_format=%d", cd->source_format);
355355
cd->config = comp_get_data_blob(cd->model_handler, &data_size, NULL);
356-
if (cd->config && data_size > 0) {
356+
/* the blob is dereferenced as a struct sof_drc_config below and in
357+
* drc_setup(), so require it to be at least that large
358+
*/
359+
if (cd->config && data_size >= sizeof(struct sof_drc_config)) {
357360
ret = drc_setup(mod, channels, rate);
358361
if (ret < 0) {
359362
comp_err(dev, "error: drc_setup failed.");

0 commit comments

Comments
 (0)