dmabuf: Don't crash clients by sending version inappropriate events
authorDerek Foreman <derekf@osg.samsung.com>
Mon, 26 Jun 2017 20:55:44 +0000 (15:55 -0500)
committerDaniel Stone <daniels@collabora.com>
Mon, 3 Jul 2017 15:42:06 +0000 (16:42 +0100)
We need to make sure the client bound dmabuf with a high enough
version to receive modifier events before sending them or the
client will crash.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
libweston/linux-dmabuf.c

index ac219ac36d160c0fe2b1e5d2b8266885f062de5c..d81b63d54b23580223823ab8868956d60525cf11 100644 (file)
@@ -483,6 +483,8 @@ bind_linux_dmabuf(struct wl_client *client,
        wl_resource_set_implementation(resource, &linux_dmabuf_implementation,
                                       compositor, NULL);
 
+       if (version < ZWP_LINUX_DMABUF_V1_MODIFIER_SINCE_VERSION)
+               return;
        /*
         * Use EGL_EXT_image_dma_buf_import_modifiers to query and advertise
         * format/modifier codes.