[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#685328: GLX_INTEL_swap_event crashes driver when swapping window buffers



Package: libgl1-mesa-glx
Version: 8.0.4-1
Severity: important
Tags: patch, upstream

Dear Maintainer,
When enabling GLX_INTEL_swap_event for windows:
in the file src/glx/dri2.c:
DRI2WireToEvent assumes the event it is generating is asociated with a
GLXPixmap, and tries to look up the pixmap in the glxDrawHash hash
table, but as the buffer swap is for a _WINDOW_ not a pixmap the result
is NULL. DRI2WireToEvent then dereferences the null pointer, and SEGVs.

The attached patch handles this situation gracefully.

diff --git b/src/glx/dri2.c a/src/glx/dri2.c
index b1b5013..2cbe968 100644
--- b/src/glx/dri2.c
+++ a/src/glx/dri2.c
@@ -130,10 +130,17 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
       aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;

       glxDraw = GetGLXDrawable(dpy, pdraw->drawable);
-      if (awire->sbc < glxDraw->lastEventSbc)
-        glxDraw->eventSbcWrap += 0x100000000;
-      glxDraw->lastEventSbc = awire->sbc;
-      aevent->sbc = awire->sbc + glxDraw->eventSbcWrap;
+      if(glxDraw)
+      {
+         if (awire->sbc < glxDraw->lastEventSbc)
+           glxDraw->eventSbcWrap += 0x100000000;
+         glxDraw->lastEventSbc = awire->sbc;
+         aevent->sbc = awire->sbc + glxDraw->eventSbcWrap;
+      }
+      else
+      {
+         aevent->sbc = awire->sbc;
+      }

       return True;
    }


Reply to: