From 9c124ae78a893755cdc581f793f60d053eab5e61 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 7 May 2025 14:19:45 +0200 Subject: [PATCH] Xi: exevents: extra asserts on NULL pointers Even though shouldn't be practically hit, better have some asserts, giving us an idea of the point of cause, instead of segfaulting, just in case. Signed-off-by: Enrico Weigelt, metux IT consult --- Xi/exevents.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Xi/exevents.c b/Xi/exevents.c index b8e2c489f..07d91072d 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -491,6 +491,7 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to) if (!k->xkb_sli) continue; if (k->xkb_sli->flags & XkbSLI_IsDefault) { + assert(to->key); k->xkb_sli->names = to->key->xkbInfo->desc->names->indicators; k->xkb_sli->maps = to->key->xkbInfo->desc->indicators->maps; } @@ -1044,6 +1045,7 @@ TouchClientWantsOwnershipEvents(ClientPtr client, DeviceIntPtr dev, { InputClients *iclient; + assert(wOtherInputMasks(win)); nt_list_for_each_entry(iclient, wOtherInputMasks(win)->inputClients, next) { if (rClient(iclient) != client) continue; @@ -1389,6 +1391,8 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti, else evtype = GetXI2Type(ev->any.type); + assert(iclients); + assert(wOtherInputMasks(*win)); nt_list_for_each_entry(iclients, wOtherInputMasks(*win)->inputClients, next) if (xi2mask_isset(iclients->xi2mask, dev, evtype)) @@ -1403,6 +1407,7 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti, int xi_type = GetXIType(TouchGetPointerEventType(ev)); Mask xi_filter = event_get_filter_from_type(dev, xi_type); + assert(wOtherInputMasks(*win)); nt_list_for_each_entry(iclients, wOtherInputMasks(*win)->inputClients, next) if (iclients->mask[dev->id] & xi_filter) @@ -2292,6 +2297,7 @@ RetrieveGestureDeliveryData(DeviceIntPtr dev, InternalEvent *ev, GestureListener listener->type == GESTURE_LISTENER_REGULAR */ evtype = GetXI2Type(ev->any.type); + assert(wOtherInputMasks(*win)); nt_list_for_each_entry(iclients, wOtherInputMasks(*win)->inputClients, next) if (xi2mask_isset(iclients->xi2mask, dev, evtype)) break; @@ -2681,6 +2687,7 @@ SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client, return BadAccess; } } + assert(wOtherInputMasks(pWin)); for (others = wOtherInputMasks(pWin)->inputClients; others; others = others->next) { if (SameClient(others, client)) { @@ -3340,6 +3347,7 @@ XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client, if (len && !others) { if (AddExtensionClient(win, client, 0, 0) != Success) return BadAlloc; + assert(wOtherInputMasks(win)); others = wOtherInputMasks(win)->inputClients; } @@ -3349,6 +3357,7 @@ XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client, } if (len) { + assert(others); xi2mask_set_one_mask(others->xi2mask, dev->id, mask, len); }