mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
dix: avoid null dereference if wOtherInputMasks() returns NULL
The wOtherInputMasks(win) macro will return NULL if
win->optional is NULL.
Reported in #1817:
xwayland-24.1.6/redhat-linux-build/../dix/gestures.c:242:9:
warning[-Wanalyzer-null-dereference]: dereference of NULL ‘inputMasks’
xwayland-24.1.6/redhat-linux-build/../dix/touch.c:765:9:
warning[-Wanalyzer-null-dereference]: dereference of NULL ‘inputMasks’
xwayland-24.1.6/redhat-linux-build/../dix/touch.c:782:9:
warning[-Wanalyzer-null-dereference]: dereference of NULL ‘inputMasks’
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2078>
(cherry picked from commit 15496a5e3d)
This commit is contained in:
@@ -234,6 +234,7 @@ GestureAddRegularListener(DeviceIntPtr dev, GestureInfoPtr gi, WindowPtr win, In
|
||||
return;
|
||||
|
||||
inputMasks = wOtherInputMasks(win);
|
||||
BUG_RETURN(!inputMasks);
|
||||
|
||||
if (mask & EVENT_XI2_MASK) {
|
||||
nt_list_for_each_entry(iclients, inputMasks->inputClients, next) {
|
||||
|
||||
@@ -760,6 +760,8 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
||||
inputMasks = wOtherInputMasks(win);
|
||||
|
||||
if (mask & EVENT_XI2_MASK) {
|
||||
BUG_RETURN_VAL(!inputMasks, FALSE);
|
||||
|
||||
nt_list_for_each_entry(iclients, inputMasks->inputClients, next) {
|
||||
if (!xi2mask_isset(iclients->xi2mask, dev, evtype))
|
||||
continue;
|
||||
@@ -777,6 +779,8 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
||||
int xitype = GetXIType(TouchGetPointerEventType(ev));
|
||||
Mask xi_filter = event_get_filter_from_type(dev, xitype);
|
||||
|
||||
BUG_RETURN_VAL(!inputMasks, FALSE);
|
||||
|
||||
nt_list_for_each_entry(iclients, inputMasks->inputClients, next) {
|
||||
if (!(iclients->mask[dev->id] & xi_filter))
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user