[PATCH weston] SIGSEGV in window.c

Kristian Høgsberg hoegsberg at gmail.com
Wed Aug 28 22:54:22 PDT 2013


On Tue, Aug 27, 2013 at 10:13:09PM +0100, Paul Winwood wrote:
> Please go easy with me; this is the first time I have ever done
> this!  I have found and fixed a SIGSEGV in window.c in
> pointer_handle_motion caused by dereferencing 'window' when it is
> null.  There was a null pointer check after the dereference. The fix
> is to move the check before it.

Hi Paul,

Yup, I see the problem and your fix is almost right.

> Patch:
> --- weston/clients/window.c.orig	2013-08-27 20:43:00.000000000 +0100
> +++ weston/clients/window.c	2013-08-27 21:56:27.271755837 +0100
> @@ -2904,6 +2904,9 @@ pointer_handle_motion(void *data, struct
>  	float sx = wl_fixed_to_double(sx_w);
>  	float sy = wl_fixed_to_double(sy_w);
>  
> +	if (!window)
> +	  return;
> +	  
>  	/* when making the window smaller - e.g. after a unmaximise we might
>  	 * still have a pending motion event that the compositor has picked
>  	 * based on the old surface dimensions
> @@ -2915,9 +2918,6 @@ pointer_handle_motion(void *data, struct
>  	input->sx = sx;
>  	input->sy = sy;

We need these two assignments moved up as well, or another way to put
it is that the check added in 5f087746ee00573fb8e067d3c25ec2b608e1ffe1
should have been added below the "if (!window) return;".

If you can make that change and then commit the patch and send it to
the list using

 $ git send-email -1 --to=wayland-devel at lists.freedesktop.org 

it should be good to go.

Thanks,
Kristian

> -	if (!window)
> -		return;
> -
>  	if (!(input->grab && input->grab_button)) {
>  		widget = window_find_widget(window, sx, sy);
>  		input_set_focus_widget(input, widget, sx, sy);
> 
> Is this OK?
> Thanks,
> Paul.
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list