Skip to content

Commit 913a776

Browse files
committed
waves: check remaining size before reading a tlv header
The config parse loop read a parameter header before confirming a whole header remained in the blob, reading past it near the end. Bound the read by the remaining size. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent f746543 commit 913a776

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

  • src/audio/module_adapter/module/waves

src/audio/module_adapter/module/waves/waves.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,15 @@ static int waves_effect_apply_config(struct processing_module *mod)
612612
for (index = 0; index < cfg->size && (!ret); param_number++) {
613613
uint32_t param_data_size;
614614

615+
/* make sure a whole param header remains before reading
616+
* param->size / param->id below
617+
*/
618+
if (index + header_size > cfg->size) {
619+
comp_err(dev, "module_param header at index %u (header %u) exceeds cfg size %zu",
620+
index, header_size, cfg->size);
621+
return -EINVAL;
622+
}
623+
615624
param = (struct module_param *)((char *)cfg->data + index);
616625
param_data_size = param->size - sizeof(param->size) - sizeof(param->id);
617626

0 commit comments

Comments
 (0)