Skip to content

Commit 215e5fe

Browse files
CassivsGabriellisbroonie
authored andcommitted
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 <cassiogabrielcontato@gmail.com> Acked-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://patch.msgid.link/20260319-sof-topology-array-size-fix-v1-1-f9191b16b1b7@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent a437601 commit 215e5fe

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

sound/soc/sof/topology.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ static int sof_parse_token_sets(struct snd_soc_component *scomp,
736736
asize = le32_to_cpu(array->size);
737737

738738
/* validate asize */
739-
if (asize < 0) { /* FIXME: A zero-size array makes no sense */
739+
if (asize < sizeof(*array)) {
740740
dev_err(scomp->dev, "error: invalid array size 0x%x\n",
741741
asize);
742742
return -EINVAL;

0 commit comments

Comments
 (0)