Mesa (master): st/mesa: don't dereference stObj->pt if NULL

Dave Airlie airlied at kemper.freedesktop.org
Sun Sep 15 22:33:14 UTC 2013


Module: Mesa
Branch: master
Commit: 2f508f244e8e4cb4bb2b9f813548fbf0c89b77c1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f508f244e8e4cb4bb2b9f813548fbf0c89b77c1

Author: Dave Airlie <airlied at gmail.com>
Date:   Tue Sep 10 14:46:23 2013 +1000

st/mesa: don't dereference stObj->pt if NULL

It seems a user app can get us into this state, I trigger the fail
running fbo-maxsize inside virgl, it fails to create the backing
storage for the texture object, but then segfaults here when it
should fail the completeness test.

Cc: "9.2" <mesa-stable at lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp at vmware.com>
Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/mesa/state_tracker/st_cb_fbo.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 77aaccd..2089482 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -502,7 +502,7 @@ st_validate_attachment(struct gl_context *ctx,
    if (att->Type != GL_TEXTURE)
       return GL_TRUE;
 
-   if (!stObj)
+   if (!stObj || !stObj->pt)
       return GL_FALSE;
 
    format = stObj->pt->format;




More information about the mesa-commit mailing list