[PATCH v4 02/10] topology: decode: Fix infinite loop in decoding enum control
Piotr Maziarz
piotrx.maziarz at linux.intel.com
Mon Aug 31 11:08:55 CEST 2020
Accessing memory outside of allocated boundaries caused segmentation fault.
Signed-off-by: Piotr Maziarz <piotrx.maziarz at linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski at intel.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski at linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
---
src/topology/ctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/topology/ctl.c b/src/topology/ctl.c
index 6e6c1d1..0aa49ab 100644
--- a/src/topology/ctl.c
+++ b/src/topology/ctl.c
@@ -1367,7 +1367,7 @@ int tplg_decode_control_enum1(snd_tplg_t *tplg,
et->texts = tplg_calloc(heap, sizeof(char *) * ec->items);
if (!et->texts)
return -ENOMEM;
- for (i = 0; ec->items; i++) {
+ for (i = 0; i < ec->items; i++) {
unsigned int j = i * sizeof(int) * ENUM_VAL_SIZE;
et->texts[i] = ec->texts[i];
et->values[i] = (int *)&ec->values[j];
--
2.7.4
More information about the Alsa-devel
mailing list