From 8ceb235c9cbb9504e32479db54287ed9387df75a Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 5 Sep 2011 12:03:29 -0700 Subject: [PATCH] glsl/ir_reader: Make sure constants have the right number of components. The list of numbers in (constant type ()) needs to contain exactly type->components() numbers (16 for a mat4, 3 for a vec3, etc.) Signed-off-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/glsl/ir_reader.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 22009ee..10bf72a 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -820,6 +820,11 @@ ir_reader::read_constant(s_expression *expr) } ++k; } + if (k != type->components()) { + ir_read_error(values, "expected %d constant values, found %d", + type->components(), k); + return NULL; + } return new(mem_ctx) ir_constant(type, &data); } -- 2.7.4