[Mesa-dev] [PATCH 2/2] glsl/ast: don't accept function calls as constructors.

Dave Airlie airlied at gmail.com
Tue May 3 04:39:41 UTC 2016


From: Dave Airlie <airlied at redhat.com>

This fixes a crash in
GL43-CTS.shader_subroutine.subroutines_not_allowed_as_variables_constructors_and_argument_or_return_types

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/compiler/glsl/ast_function.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp
index 37fb3e79..fe0df15 100644
--- a/src/compiler/glsl/ast_function.cpp
+++ b/src/compiler/glsl/ast_function.cpp
@@ -2031,7 +2031,10 @@ ast_function_expression::hir(exec_list *instructions,
       process_parameters(instructions, &actual_parameters, &this->expressions,
 			 state);
 
-      if (id->oper == ast_array_index) {
+      if (id->oper == ast_function_call) {
+         _mesa_glsl_error(& loc, state, "function call cannot be used as a constructor\n");
+	 return ir_rvalue::error_value(ctx);
+      } else if (id->oper == ast_array_index) {
          array_idx = generate_array_index(ctx, instructions, state, loc,
                                           id->subexpressions[0],
                                           id->subexpressions[1], &func_name,
-- 
2.5.5



More information about the mesa-dev mailing list