[krh/weston/next 4/8] compositor: Avoid dereferencing null pointer in clip_pointer_motion.

John Kåre Alsaker john.kare.alsaker at gmail.com
Tue Oct 16 11:46:28 PDT 2012


On Tue, Oct 16, 2012 at 5:32 PM, Kristian Høgsberg <hoegsberg at gmail.com> wrote:
> On Fri, Oct 12, 2012 at 12:25:08PM +0200, John Kåre Alsaker wrote:
>> ---
>>  src/compositor.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/compositor.c b/src/compositor.c
>> index f96d675..e1411a4 100644
>> --- a/src/compositor.c
>> +++ b/src/compositor.c
>> @@ -1474,7 +1474,7 @@ clip_pointer_motion(struct weston_seat *seat, wl_fixed_t *fx, wl_fixed_t *fy)
>>                       prev = output;
>>       }
>>
>> -     if (!valid) {
>> +     if (!valid && prev) {
>
> No, prev should never be NULL here. If it is, this is just papering
> over errors elsewhere.
>
> Kristian
>
So there can't be any case where old_x or old_y points outside the
current output list? Say if a output disconnected, rounding errors,
etc.? If there is no such case we should just add an assertion here.

>>               if (x < prev->x)
>>                       *fx = wl_fixed_from_int(prev->x);
>>               else if (x >= prev->x + prev->width)
>> --
>> 1.7.12.2
>>
>> _______________________________________________
>> 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