mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-20 07:00:03 +01: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>
This commit is contained in:
parent
dedceb52bc
commit
15496a5e3d
2 changed files with 5 additions and 0 deletions
|
|
@ -234,6 +234,7 @@ GestureAddRegularListener(DeviceIntPtr dev, GestureInfoPtr gi, WindowPtr win, In
|
||||||
return;
|
return;
|
||||||
|
|
||||||
inputMasks = wOtherInputMasks(win);
|
inputMasks = wOtherInputMasks(win);
|
||||||
|
BUG_RETURN(!inputMasks);
|
||||||
|
|
||||||
if (mask & EVENT_XI2_MASK) {
|
if (mask & EVENT_XI2_MASK) {
|
||||||
nt_list_for_each_entry(iclients, inputMasks->inputClients, next) {
|
nt_list_for_each_entry(iclients, inputMasks->inputClients, next) {
|
||||||
|
|
|
||||||
|
|
@ -760,6 +760,8 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
||||||
inputMasks = wOtherInputMasks(win);
|
inputMasks = wOtherInputMasks(win);
|
||||||
|
|
||||||
if (mask & EVENT_XI2_MASK) {
|
if (mask & EVENT_XI2_MASK) {
|
||||||
|
BUG_RETURN_VAL(!inputMasks, FALSE);
|
||||||
|
|
||||||
nt_list_for_each_entry(iclients, inputMasks->inputClients, next) {
|
nt_list_for_each_entry(iclients, inputMasks->inputClients, next) {
|
||||||
if (!xi2mask_isset(iclients->xi2mask, dev, evtype))
|
if (!xi2mask_isset(iclients->xi2mask, dev, evtype))
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -777,6 +779,8 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
||||||
int xitype = GetXIType(TouchGetPointerEventType(ev));
|
int xitype = GetXIType(TouchGetPointerEventType(ev));
|
||||||
Mask xi_filter = event_get_filter_from_type(dev, xitype);
|
Mask xi_filter = event_get_filter_from_type(dev, xitype);
|
||||||
|
|
||||||
|
BUG_RETURN_VAL(!inputMasks, FALSE);
|
||||||
|
|
||||||
nt_list_for_each_entry(iclients, inputMasks->inputClients, next) {
|
nt_list_for_each_entry(iclients, inputMasks->inputClients, next) {
|
||||||
if (!(iclients->mask[dev->id] & xi_filter))
|
if (!(iclients->mask[dev->id] & xi_filter))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue