Xi: don't try to set oversized or non-existing masks.
Fixes crash if the first XISelectEvents has a zero sized event mask. Fixes crash if the mask provided is larger than others->xi2mask[]. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
6fe235d363
commit
83db2b126e
|
@ -2148,15 +2148,18 @@ XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!others && len)
|
len = min(len, sizeof(others->xi2mask[dev->id]));
|
||||||
|
|
||||||
|
if (len && !others)
|
||||||
{
|
{
|
||||||
AddExtensionClient(win, client, 0, 0);
|
AddExtensionClient(win, client, 0, 0);
|
||||||
others= wOtherInputMasks(win)->inputClients;
|
others= wOtherInputMasks(win)->inputClients;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!len)
|
if (others)
|
||||||
memset(others->xi2mask[dev->id], 0, sizeof(others->xi2mask[dev->id]));
|
memset(others->xi2mask[dev->id], 0, sizeof(others->xi2mask[dev->id]));
|
||||||
else
|
|
||||||
|
if (len)
|
||||||
memcpy(others->xi2mask[dev->id], mask, len);
|
memcpy(others->xi2mask[dev->id], mask, len);
|
||||||
|
|
||||||
RecalculateDeviceDeliverableEvents(win);
|
RecalculateDeviceDeliverableEvents(win);
|
||||||
|
|
Loading…
Reference in New Issue