From: Kenneth Graunke Date: Mon, 5 Sep 2011 19:03:29 +0000 (-0700) Subject: glsl/ir_reader: Make sure constants have the right number of components. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8ceb235c9cbb9504e32479db54287ed9387df75a;p=mesa.git 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 --- diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 22009eebcb9..10bf72aeeb8 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); }