gl_drm: Check dmabuf attribute version before trusting attributes
authorDerek Foreman <derekf@osg.samsung.com>
Thu, 29 Jun 2017 18:54:48 +0000 (13:54 -0500)
committerDerek Foreman <derekf@osg.samsung.com>
Thu, 29 Jun 2017 21:12:35 +0000 (16:12 -0500)
We shouldn't do anything with a dmabuf structure until confirming the
version matches the one we know.

src/modules/evas/engines/gl_drm/evas_engine.c

index fe69ef0..4413446 100644 (file)
@@ -1197,10 +1197,11 @@ eng_image_native_set(void *engine, void *image, void *native)
              if (!ns->data.wl_dmabuf.resource)
                {
                   struct dmabuf_attributes *attr;
-                  void *v;
+                  void *v = NULL;
 
                   attr = ns->data.wl_dmabuf.attr;
-                  v = gl_import_simple_dmabuf(ob->egl.disp, attr);
+                  if (attr->version == EVAS_DMABUF_ATTRIBUTE_VERSION)
+                    v = gl_import_simple_dmabuf(ob->egl.disp, attr);
                   if (!v) {
                        ns->data.wl_dmabuf.attr = NULL;
                        return NULL;