mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-04 13:30:08 -05:00
topology: decode: Fix infinite loop in decoding enum control
Accessing memory outside of allocated boundaries caused segmentation fault. Signed-off-by: Piotr Maziarz <piotrx.maziarz@linux.intel.com> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
1ac965184e
commit
346a5efa87
1 changed files with 1 additions and 1 deletions
|
|
@ -1367,7 +1367,7 @@ int tplg_decode_control_enum1(snd_tplg_t *tplg,
|
||||||
et->texts = tplg_calloc(heap, sizeof(char *) * ec->items);
|
et->texts = tplg_calloc(heap, sizeof(char *) * ec->items);
|
||||||
if (!et->texts)
|
if (!et->texts)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
for (i = 0; ec->items; i++) {
|
for (i = 0; i < ec->items; i++) {
|
||||||
unsigned int j = i * sizeof(int) * ENUM_VAL_SIZE;
|
unsigned int j = i * sizeof(int) * ENUM_VAL_SIZE;
|
||||||
et->texts[i] = ec->texts[i];
|
et->texts[i] = ec->texts[i];
|
||||||
et->values[i] = (int *)&ec->values[j];
|
et->values[i] = (int *)&ec->values[j];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue