Skip to content

Commit e31339d

Browse files
committed
audio: cadence: validate TLV param size before applying config
Bound each host-supplied module_param against the bytes remaining to avoid an OOB read or a stalled loop. Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
1 parent e7b9dbe commit e31339d

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/audio/module_adapter/module/cadence.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,16 @@ int cadence_codec_apply_params(struct processing_module *mod, int size, void *da
358358
*/
359359
while (size > 0) {
360360
param = data;
361+
362+
/* Host-supplied blob: bound param->size before dereferencing. */
363+
if (size < (int)sizeof(*param) ||
364+
param->size <= sizeof(*param) ||
365+
param->size > (uint32_t)size) {
366+
comp_err(dev, "invalid param size %u, %d bytes left",
367+
param->size, size);
368+
return -EINVAL;
369+
}
370+
361371
comp_dbg(dev, "cadence_codec_apply_config() applying param %d value %d",
362372
param->id, param->data[0]);
363373

0 commit comments

Comments
 (0)