mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-31 22:34:33 +01:00
ASoC: SOF: topology: reject invalid vendor array size in token parser
sof_parse_token_sets() accepts array->size values that can be invalid for a vendor tuple array header. In particular, a zero size does not advance the parser state and can lead to non-progress parsing on malformed topology data. Validate array->size against the minimum header size and reject values smaller than sizeof(*array) before parsing. This preserves behavior for valid topologies and hardens malformed-input handling. Signed-off-by: Cássio Gabriel <[email protected]> Acked-by: Peter Ujfalusi <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
This commit is contained in:
1 parent
a437601a0a
commit
215e5fe758
1 file changed
+1
-1
@@ -736,7 +736,7 @@ static int sof_parse_token_sets(struct snd_soc_component *scomp,
|
||||
asize = le32_to_cpu(array->size);
|
||||
|
||||
/* validate asize */
|
||||
if (asize < 0) { /* FIXME: A zero-size array makes no sense */
|
||||
if (asize < sizeof(*array)) {
|
||||
dev_err(scomp->dev, "error: invalid array size 0x%x\n",
|
||||
asize);
|
||||
return -EINVAL;
|
||||
|
||||
Reference in new issue
Block a user