glsl/ir_reader: Make sure constants have the right number of components.
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 5 Sep 2011 19:03:29 +0000 (12:03 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 7 Sep 2011 14:49:32 +0000 (07:49 -0700)
The list of numbers in (constant type (<numbers>)) needs to contain
exactly type->components() numbers (16 for a mat4, 3 for a vec3, etc.)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/ir_reader.cpp

index 22009eebcb94245c635f4b73cd2a5d82fd96f95d..10bf72aeeb847c9953280ae242d94ece0c159978 100644 (file)
@@ -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);
 }