Files
xserver/dix/input_priv.h
Alexandre Janon 16ee02ab67 dix: ensure that event fix-up is not performed on core events
CoreEnterLeaveEvent calls FixUpEventFromWindow with a pointer to a stack-allocated xEvent structure, which may get later casted into an xXIDeviceEvent*, with writes done by FixUpXI2DeviceEventFromWindow at an offset larger than sizeof(xEvent). This code-path is protected by xi2_get_type() but the following warning is generated by building with -O3 and LTO:

In function 'FixUpXI2DeviceEventFromWindow',
    inlined from 'FixUpEventFromWindow' at ../dix/events.c:2716:13,
    inlined from 'CoreEnterLeaveEvent' at ../dix/events.c:4679:5:
../dix/events.c:2628:48: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 2628 |         ((xXIEnterEvent *) event)->same_screen =
      |                                                ^
../dix/events.c: In function 'CoreEnterLeaveEvent':
../dix/events.c:4652:12: note: at offset 48 into destination object 'event' of size 32
 4652 |     xEvent event = {
      |            ^

This PR suppresses this warning, by tracking the level of the event (ie., core event, XI or XI2) and ensuring that fix-up is performed only on XI2 events.

Signed-off-by: alex14fr <alex14fr@gmail.com>
2025-09-29 17:15:16 +02:00

20 KiB