Commit d6c3768b authored by Prasad J Pandit's avatar Prasad J Pandit Committed by Peter Maydell
Browse files

hw/display/tc6393xb: limit irq handler index to TC6393XB_GPIOS



The ctz32() routine could return a value greater than
TC6393XB_GPIOS=16, because the device has 24 GPIO level
bits but we only implement 16 outgoing lines. This could
lead to an OOB array access. Mask 'level' to avoid it.

Reported-by: default avatarMoguofang <moguofang@huawei.com>
Signed-off-by: default avatarPrasad J Pandit <pjp@fedoraproject.org>
Message-id: 20171212041539.25700-1-ppandit@redhat.com
Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>
Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parent 27f26bfe
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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);