st/mesa: Fix NULL pointer dereference for incomplete framebuffers
authorMichel Dänzer <michel.daenzer@amd.com>
Fri, 25 Apr 2014 02:40:39 +0000 (11:40 +0900)
committerMichel Dänzer <michel@daenzer.net>
Mon, 28 Apr 2014 03:12:03 +0000 (12:12 +0900)
This can happen with glamor, which uses EGL_KHR_surfaceless_context and
only explicitly binds GL_READ_FRAMEBUFFER for glReadPixels.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/state_tracker/st_manager.c

index f573877dc04d35c598a9e510295ff26bde38c7c7..706af7fd13d59265788c41377bfe1e447e2f1a2d 100644 (file)
@@ -183,8 +183,13 @@ st_framebuffer_validate(struct st_framebuffer *stfb,
    uint width, height;
    unsigned i;
    boolean changed = FALSE;
-   int32_t new_stamp = p_atomic_read(&stfb->iface->stamp);
+   int32_t new_stamp;
 
+   /* Check for incomplete framebuffers (e.g. EGL_KHR_surfaceless_context) */
+   if (!stfb->iface)
+      return;
+
+   new_stamp = p_atomic_read(&stfb->iface->stamp);
    if (stfb->iface_stamp == new_stamp)
       return;