[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] display: check irq handler index before access
From: |
P J P |
Subject: |
[Qemu-devel] [PATCH] display: check irq handler index before access |
Date: |
Mon, 11 Dec 2017 16:25:46 +0530 |
From: Prasad J Pandit <address@hidden>
The ctz32() routine could return value greater than
TC6393XB_GPIOS=16. This could lead to an OOB array access.
Add check to avoid it.
Reported-by: Moguofang <address@hidden>
Signed-off-by: Prasad J Pandit <address@hidden>
---
hw/display/tc6393xb.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/display/tc6393xb.c b/hw/display/tc6393xb.c
index 74d10af3d4..78292cb847 100644
--- a/hw/display/tc6393xb.c
+++ b/hw/display/tc6393xb.c
@@ -175,6 +175,10 @@ static void tc6393xb_gpio_handler_update(TC6393xbState *s)
for (diff = s->prev_level ^ level; diff; diff ^= 1 << bit) {
bit = ctz32(diff);
+ if (bit >= TC6393XB_GPIOS) {
+ fprintf(stderr, "TC6393xb: no GPIO pin %d\n", bit);
+ return;
+ }
qemu_set_irq(s->handler[bit], (level >> bit) & 1);
}
--
2.13.6
- [Qemu-devel] [PATCH] display: check irq handler index before access,
P J P <=