display: limit irq handler index to TC6393XB_GPIOS
PATCH 1/1 display: limit irq handler index to TC6393XB_GPIOS
From: Prasad J Pandit <[email protected]>
The ctz32() routine could return value greater than TC6393XB_GPIOS=16. This could lead to an OOB array access. Mask 'level' to avoid it.
--- hw/display/tc6393xb.c | 1 + 1 file changed, 1 insertion(+)
Update: mask 'level' value to TC6393XB_GPIOS=16
-> https://lists.gnu.org/archive/html/qemu-devel/2017-12/msg01685.html
hw/display/tc6393xb.c +1 -0
@@ -172,6 +172,7 @@ static void tc6393xb_gpio_handler_update(TC6393xbState *s)int bit; level = s->gpio_level & s->gpio_dir; + level &=MAKE_64BIT_MASK (0 ,TC6393XB_GPIOS );for (diff = s->prev_level ^ level; diff; diff ^=1 << bit) { bit =ctz32 (diff);
Signature · 1 line
2.13.6
Quoted 20 lines · P J P
From: Prasad J Pandit <[email protected]>
The
ctz32()routine could return value greater than TC6393XB_GPIOS=16. This could lead to an OOB array access. Mask 'level' to avoid it.Reported-by Moguofang <[email protected]>Signed-off-by Prasad J Pandit <[email protected]>--- hw/display/tc6393xb.c | 1 + 1 file changed, 1 insertion(+)Update: mask 'level' value to TC6393XB_GPIOS=16
-> https://lists.gnu.org/archive/html/qemu-devel/2017-12/msg01685.htmlhw/display/tc6393xb.c +0
-0
hw/display/tc6393xb.c static void tc6393xb_gpio_handler_update(TC6393xbState *s) · line 178
Quoted 7 lines
hw/display/tc6393xb.c +1
-0@@ -172,6 +172,7 @@ static void tc6393xb_gpio_handler_update(TC6393xbState *s)int bit; level = s->gpio_level & s->gpio_dir; + level &=MAKE_64BIT_MASK (0 ,TC6393XB_GPIOS );for (diff = s->prev_level ^ level; diff; diff ^=1 << bit) { bit =ctz32 (diff);
Thanks; applied to target-arm.next for 2.12.
-- PMM