Mesa (master): glsl: Reject structure constructors that have too many arguments.

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Sep 2 03:40:10 UTC 2010


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Sep  1 19:44:25 2010 -0700

glsl: Reject structure constructors that have too many arguments.

Fixes piglit test constructor-27.vert.

---

 src/glsl/ast_function.cpp |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
index 1cd300c..c3b4441 100644
--- a/src/glsl/ast_function.cpp
+++ b/src/glsl/ast_function.cpp
@@ -1207,6 +1207,12 @@ ast_function_expression::hir(exec_list *instructions,
 	    node = node->next;
 	 }
 
+	 if (!node->is_tail_sentinel()) {
+	    _mesa_glsl_error(&loc, state, "too many parameters in constructor "
+			     "for `%s'", type->name);
+	    return ir_call::get_error_instruction(ctx);
+	 }
+
 	 ir_rvalue *const constant =
 	    constant_record_constructor(type, &actual_parameters, state);
 




More information about the mesa-commit mailing list