Xi: start checking for invalid mask bits _after_ LASTEVENT.
Two issues that combined to false positives and false negatives. - The checking for invalid bits must be performed when there are enough bits that an event outside of LASTEVENT may be selected. - The first invalid bit is LASTEVENT + 1, not LASTEVENT. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
e2fbaebb87
commit
9563feeeb5
|
@ -108,10 +108,10 @@ ProcXISelectEvent(ClientPtr client)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((evmask->mask_len * 4) > XI_LASTEVENT)
|
if ((evmask->mask_len * 4) >= (XI_LASTEVENT + 8)/8)
|
||||||
{
|
{
|
||||||
unsigned char *bits = (unsigned char*)&evmask[1];
|
unsigned char *bits = (unsigned char*)&evmask[1];
|
||||||
for (i = XI_LASTEVENT; i < evmask->mask_len * 4; i++)
|
for (i = XI_LASTEVENT + 1; i < evmask->mask_len * 4; i++)
|
||||||
{
|
{
|
||||||
if (BitIsOn(bits, i))
|
if (BitIsOn(bits, i))
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
Loading…
Reference in New Issue