[Mesa-dev] [PATCH] glsl: add null pointer check in print_without_declaration()
Nicolai Hähnle
nhaehnle at gmail.com
Fri Mar 31 06:01:26 UTC 2017
On 31.03.2017 05:21, Brian Paul wrote:
> 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);
> + }
Is the output still usable in this case? I don't quite understand the
use case and how this case can happen.
Thanks,
Nicolai
> }
>
> if (i < num_op - 1)
>
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
More information about the mesa-dev
mailing list