Mesa (master): main: fix basename match's check if it's an array or struct

Samuel Iglesias Gonsálvez samuelig at kemper.freedesktop.org
Fri Oct 30 07:27:29 UTC 2015


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

Author: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
Date:   Tue Oct 27 14:21:12 2015 +0100

main: fix basename match's check if it's an array or struct

Commit 4565b6f did not update the basename match's check for
the case that string would exactly match the name of the
variable if the suffix "[0]" were appended to it.

Fixes two dEQP-GLES31 tests:

dEQP-GLES31.functional.program_interface_query.shader_storage_block.resource_list.block_array
dEQP-GLES31.functional.program_interface_query.shader_storage_block.resource_list.block_array_single_element

v2:
- Change the position of rname_has_array_index_zero to avoid an out-of-bounds
  read. Reported by Tapani Pälli.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
Reviewed-by: Tapani Pälli <tapani.palli at intel.com>

---

 src/mesa/main/shader_query.cpp |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 59ec3d7..fc0276f 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -590,7 +590,8 @@ _mesa_program_resource_find_name(struct gl_shader_program *shProg,
          case GL_UNIFORM_BLOCK:
          case GL_SHADER_STORAGE_BLOCK:
             /* Basename match, check if array or struct. */
-            if (name[baselen] == '\0' ||
+            if (rname_has_array_index_zero ||
+                name[baselen] == '\0' ||
                 name[baselen] == '[' ||
                 name[baselen] == '.') {
                return res;




More information about the mesa-commit mailing list