xserver-multidpi/hw/xwayland
Olivier Fourdan 59ad0e6a41 xwayland: Fix use after free of cursors
Sometimes, Xwayland will try to use a cursor that has just been freed,
leading to a crash when trying to access that cursor data either in
miPointerUpdateSprite() or AnimCurTimerNotify().

CheckMotion() updates the pointer's cursor based on which xwindow
XYToWindow() returns, and Xwayland implements its own xwl_xy_to_window()
to fake a crossing to the root window when the pointer has left the
Wayland surface but is still within the xwindow.

But after an xwindow is unrealized, the last xwindow used to match the
xwindows is cleared so two consecutive calls to xwl_xy_to_window() may
not return the same xwindow.

To avoid this issue, update the last_xwindow based on enter and leave
notifications instead of xwl_xy_to_window(), and check if the xwindow
found by the regular miXYToWindow() is a child of the known last
xwindow, so that multiple consecutive calls to xwl_xy_to_window()
return the same xwindow, being either the one found by miXYToWindow()
or the root window.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1385258
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Tested-by: Vít Ondruch <vondruch@redhat.com>
Tested-by: Satish Balay <balay@fastmail.fm>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2016-11-30 09:46:21 +01:00
..
.gitignore xwayland: Bind pointer constraints global 2016-10-05 13:50:46 -04:00
drm.xml xwayland: Add glamor and DRI3 support 2014-06-24 15:09:55 -07:00
Makefile.am xwayland: Bind pointer constraints global 2016-10-05 13:50:46 -04:00
xwayland-cursor.c xwayland: Add pointer warp emulator 2016-10-05 13:51:02 -04:00
xwayland-cvt.c xwayland: do not include frequency in mode name 2016-03-28 14:09:09 -04:00
xwayland-glamor-xv.c xwayland: Fix compiler warning in GLAMOR Xv 2016-04-15 16:22:16 -04:00
xwayland-glamor.c glamor: Use eglGetPlatformDisplay{,EXT} if we can 2016-10-05 16:03:13 -04:00
xwayland-input.c xwayland: Fix use after free of cursors 2016-11-30 09:46:21 +01:00
xwayland-output.c xwayland: fix order of calloc() args 2016-11-25 11:35:53 +10:00
xwayland-shm.c xwayland-shm: block signals during fallocate 2016-11-01 14:00:04 -04:00
xwayland-vidmode.c xwayland: Pretend we support viewport in vidmode 2016-03-28 14:10:59 -04:00
xwayland.c xwayland: fix order of calloc() args 2016-11-25 11:35:53 +10:00
xwayland.h xwayland: Add pointer warp emulator 2016-10-05 13:51:02 -04:00