[PATCH wayland v2] server: don't send an error to NULL display_resource

Bill Spitzak spitzak at gmail.com
Mon Jan 11 11:08:51 PST 2016


I like this minimal fix better than the previous one that fixed the bug
twice.

I think it would be clearer to just state that "wl_resource_post_error will
crash if display_resource is null".


On Mon, Jan 11, 2016 at 9:33 AM, Derek Foreman <derekf at osg.samsung.com>
wrote:

> On 11/01/16 04:45 AM, Marek Chalupa wrote:
> > if display_resource = wl_resource_create() fails in bind_display(),
> > we call wl_client_post_no_memory() which is wrong, since this function
> > uses display_resource (which is NULL at this point).
> > said simply: don't send an error to resource that you've just failed to
> create)
> >
> > https://bugs.freedesktop.org/show_bug.cgi?id=91356
> >
> > Reported-by: Ashim <ashim.shah at samsung.com>
> > Signed-off-by: Marek Chalupa <mchqwerty at gmail.com>
>
> Reviewed-by: Derek Foreman <derekf at osg.samsung.com>
>
> Looks good to me - instead of trying to dereference the pointer in
> wl_resource_post_error() and crashing, now we'll clean up and kill the
> client connection in wl_client_create(), as we should.
>
> Thanks,
> Derek
>
> > ---
> >  src/wayland-server.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/wayland-server.c b/src/wayland-server.c
> > index 9e26b18..017a975 100644
> > --- a/src/wayland-server.c
> > +++ b/src/wayland-server.c
> > @@ -778,7 +778,8 @@ bind_display(struct wl_client *client, struct
> wl_display *display)
> >       client->display_resource =
> >               wl_resource_create(client, &wl_display_interface, 1, 1);
> >       if (client->display_resource == NULL) {
> > -             wl_client_post_no_memory(client);
> > +             /* DON'T send no-memory error to client - it has no
> > +              * resource to which it could post the event */
> >               return -1;
> >       }
> >
> >
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20160111/87dfd0a3/attachment-0001.html>


More information about the wayland-devel mailing list