Mesa (master): mesa: Don't call driver RenderTexture for invalid zoffset

Ian Romanick idr at kemper.freedesktop.org
Tue Aug 6 19:19:10 UTC 2013


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

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Sat Jul 27 12:16:56 2013 -0700

mesa: Don't call driver RenderTexture for invalid zoffset

This fixes the segfault in the 'invalid slice of 3D texture' and
'invalid layer of an array texture' subtests of piglit's fbo-incomplete
test.

The 'invalid layer of an array texture' subtest still fails.

v2: Fix off-by-one comparison error noticed by Chris Forbes.  Also,
1D_ARRAY textures have Depth == 1.  Instead, compare against Height.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org> [v1]
Cc: "9.1 9.2" mesa-stable at lists.freedesktop.org

---

 src/mesa/main/fbobject.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 8f70a20..06cc586 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -355,6 +355,12 @@ driver_RenderTexture_is_safe(const struct gl_renderbuffer_attachment *att)
    if (texImage->Width == 0 || texImage->Height == 0 || texImage->Depth == 0)
       return false;
 
+   if ((texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY
+        && att->Zoffset >= texImage->Height)
+       || (texImage->TexObject->Target != GL_TEXTURE_1D_ARRAY
+           && att->Zoffset >= texImage->Depth))
+      return false;
+
    return true;
 }
 




More information about the mesa-commit mailing list