glx: Check flush DRI extension version at runtime
authornobled <nobled@dreamwidth.org>
Fri, 6 May 2011 07:39:24 +0000 (09:39 +0200)
committerMichel Dänzer <daenzer@vmware.com>
Fri, 6 May 2011 07:39:24 +0000 (09:39 +0200)
The DRI driver itself might not have version 3 of the
DRI2 flush extension, in which case this would've
pointed to out of bounds memory...

src/glx/dri2_glx.c

index fc0237a4f6b122be9be662cd9104a3f6205a3c25..b9f6f7fcf031ae448cc12c69600965ce5db1d0a7 100644 (file)
@@ -679,7 +679,7 @@ dri2InvalidateBuffers(Display *dpy, XID drawable)
    struct dri2_drawable *pdp = (struct dri2_drawable *) pdraw;
 
 #if __DRI2_FLUSH_VERSION >= 3
-   if (pdraw && psc->f)
+   if (pdraw && psc->f && psc->f->base.version >= 3 && psc->f->invalidate)
        psc->f->invalidate(pdp->driDrawable);
 #endif
 }
@@ -702,7 +702,8 @@ dri2_bind_tex_image(Display * dpy,
       psc = (struct dri2_screen *) base->psc;
 
 #if __DRI2_FLUSH_VERSION >= 3
-      if (!pdp->invalidateAvailable && psc->f)
+      if (!pdp->invalidateAvailable && psc->f &&
+           psc->f->base.version >= 3 && psc->f->invalidate)
         psc->f->invalidate(pdraw->driDrawable);
 #endif