Mesa (11.0): i965: Fix crash when calling glViewport with no surface bound

Emil Velikov evelikov at kemper.freedesktop.org
Fri Jan 15 14:45:18 UTC 2016


Module: Mesa
Branch: 11.0
Commit: a802bbfa4436c7c575b4b2ce0cd50c62154f3633
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a802bbfa4436c7c575b4b2ce0cd50c62154f3633

Author: Neil Roberts <neil at linux.intel.com>
Date:   Tue Dec  8 16:35:57 2015 +0000

i965: Fix crash when calling glViewport with no surface bound

If EGL_KHR_surfaceless_context is used then glViewport can be called
with NULL for the draw and read surfaces. This was previously causing
a crash because the i965 driver tries to use this point to invalidate
the surfaces and it was derferencing the NULL pointer.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93257
Cc: Nanley Chery <nanley.g.chery at intel.com>
Cc: "11.1" <mesa-stable at lists.freedesktop.org>
Tested-by: Nanley Chery <nanley.g.chery at intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery at intel.com>
(cherry picked from commit 8c5310da9d1cbf2272f72d3ed4264544456a4683)

---

 src/mesa/drivers/dri/i965/brw_context.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 2e7b7ed..b8f40d7 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -151,8 +151,10 @@ intel_viewport(struct gl_context *ctx)
    __DRIcontext *driContext = brw->driContext;
 
    if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
-      dri2InvalidateDrawable(driContext->driDrawablePriv);
-      dri2InvalidateDrawable(driContext->driReadablePriv);
+      if (driContext->driDrawablePriv)
+         dri2InvalidateDrawable(driContext->driDrawablePriv);
+      if (driContext->driReadablePriv)
+         dri2InvalidateDrawable(driContext->driReadablePriv);
    }
 }
 




More information about the mesa-commit mailing list