[Mesa-dev] [PATCH] glsl: add null pointer check in print_without_declaration()
Brian Paul
brianp at vmware.com
Fri Mar 31 03:21:30 UTC 2017
To avoid/fix a segmentation fault when running the stand-alone GLSL
compiler utility for cases such as the Mesa demos toyball test:
glsl_compiler --dump-builder --version 120 CH11-toyball.vert CH11-toyball.frag
---
src/compiler/glsl/ir_builder_print_visitor.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/compiler/glsl/ir_builder_print_visitor.cpp b/src/compiler/glsl/ir_builder_print_visitor.cpp
index 825dbe1..164a237 100644
--- a/src/compiler/glsl/ir_builder_print_visitor.cpp
+++ b/src/compiler/glsl/ir_builder_print_visitor.cpp
@@ -581,7 +581,9 @@ ir_builder_print_visitor::print_without_declaration(const ir_expression *ir)
const struct hash_entry *const he =
_mesa_hash_table_search(index_map, ir->operands[i]);
- print_without_indent("r%04X", (unsigned)(uintptr_t) he->data);
+ if (he) {
+ print_without_indent("r%04X", (unsigned)(uintptr_t) he->data);
+ }
}
if (i < num_op - 1)
--
1.9.1
More information about the mesa-dev
mailing list