Mesa (nvfx-next-7g): glsl: don' t crash if a field is specified for a non-struct uniform

Luca Barbieri lb at kemper.freedesktop.org
Thu Aug 19 00:02:04 UTC 2010


Module: Mesa
Branch: nvfx-next-7g
Commit: 1d57e3e2ec2b62380578ddda8cae668f24d7ddcc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1d57e3e2ec2b62380578ddda8cae668f24d7ddcc

Author: Luca Barbieri <luca at luca-barbieri.com>
Date:   Wed Aug 18 12:39:18 2010 +0200

glsl: don't crash if a field is specified for a non-struct uniform

This was triggered by the previous bug, but is a separate problem
in the general sense.

---

 src/mesa/program/ir_to_mesa.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 1f3072f..825c6f4 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -1145,7 +1145,7 @@ get_builtin_uniform_reg(struct gl_program *prog,
       if (!field && statevars[i].field) {
 	 assert(!"FINISHME: whole-structure state var dereference");
       }
-      if (field && strcmp(statevars[i].field, field) != 0)
+      if (field && (!statevars[i].field || strcmp(statevars[i].field, field) != 0))
 	 continue;
       break;
    }




More information about the mesa-commit mailing list