[Mesa-dev] [PATCH 1/3] glx: Check flush DRI extension version at runtime

nobled nobled at dreamwidth.org
Thu May 5 20:44:30 PDT 2011


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 |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index ff48c79..179b7d7 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -640,7 +640,7 @@ dri2InvalidateBuffers(Display *dpy, XID drawable)
    struct dri2_drawable *pdp = (struct dri2_drawable *) pdraw;
Date: Sun, 5 Sep 2010 19:10:58 +0000

 #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
 }
@@ -663,7 +663,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

-- 
1.7.0.4


More information about the mesa-dev mailing list