Re: [PATCH xserver] xwayland: Don't crash on WarpPointer(dest_w = None)

2018-04-12 Thread Peter Hutterer
On Thu, Apr 12, 2018 at 05:24:08PM -0400, Adam Jackson wrote:
> Turns out that's legal, and xts exercises it, and we crash:
> 
> Thread 1 "Xwayland" received signal SIGSEGV, Segmentation fault.
> dixGetPrivate (key=0x813660 , privates=0x20) at 
> ../../include/privates.h:122
> 122   return (char *) (*privates) + key->offset;
> (gdb) bt
> #0  dixGetPrivate (key=0x813660 , privates=0x20) 
> at ../../include/privates.h:122
> #1  dixLookupPrivate (key=0x813660 , 
> privates=0x20) at ../../include/privates.h:166
> #2  xwl_window_of_top (window=0x0) at xwayland.c:128
> #3  xwl_cursor_warped_to (device=, screen=0x268b6e0, 
> client=, window=0x0, sprite=0x300bb30,
> x=2400, y=1350) at xwayland.c:292
> #4  0x005622ec in ProcWarpPointer (client=0x32755d0) at 
> events.c:3618
> 
> In this case, x/y are the screen-space coordinates where the pointer
> ends up, and we need to look up the (X) window there.
> 
> Signed-off-by: Adam Jackson 

Reviewed-by: Peter Hutterer 

Cheers,
   Peter

> ---
>  hw/xwayland/xwayland.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
> index e65d8b7e77..dd074c3415 100644
> --- a/hw/xwayland/xwayland.c
> +++ b/hw/xwayland/xwayland.c
> @@ -289,6 +289,9 @@ xwl_cursor_warped_to(DeviceIntPtr device,
>  if (!xwl_seat)
>  xwl_seat = xwl_screen_get_default_seat(xwl_screen);
>  
> +if (!window)
> +window = XYToWindow(sprite, x, y);
> +
>  xwl_window = xwl_window_of_top(window);
>  if (!xwl_window && xwl_seat->focus_window) {
>  focus = xwl_seat->focus_window->window;
> -- 
> 2.17.0
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver] xwayland: Don't crash on WarpPointer(dest_w = None)

2018-04-12 Thread Adam Jackson
Turns out that's legal, and xts exercises it, and we crash:

Thread 1 "Xwayland" received signal SIGSEGV, Segmentation fault.
dixGetPrivate (key=0x813660 , privates=0x20) at 
../../include/privates.h:122
122 return (char *) (*privates) + key->offset;
(gdb) bt
#0  dixGetPrivate (key=0x813660 , privates=0x20) at 
../../include/privates.h:122
#1  dixLookupPrivate (key=0x813660 , privates=0x20) 
at ../../include/privates.h:166
#2  xwl_window_of_top (window=0x0) at xwayland.c:128
#3  xwl_cursor_warped_to (device=, screen=0x268b6e0, 
client=, window=0x0, sprite=0x300bb30,
x=2400, y=1350) at xwayland.c:292
#4  0x005622ec in ProcWarpPointer (client=0x32755d0) at 
events.c:3618

In this case, x/y are the screen-space coordinates where the pointer
ends up, and we need to look up the (X) window there.

Signed-off-by: Adam Jackson 
---
 hw/xwayland/xwayland.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index e65d8b7e77..dd074c3415 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -289,6 +289,9 @@ xwl_cursor_warped_to(DeviceIntPtr device,
 if (!xwl_seat)
 xwl_seat = xwl_screen_get_default_seat(xwl_screen);
 
+if (!window)
+window = XYToWindow(sprite, x, y);
+
 xwl_window = xwl_window_of_top(window);
 if (!xwl_window && xwl_seat->focus_window) {
 focus = xwl_seat->focus_window->window;
-- 
2.17.0

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel