From e61ec95deb6e7edb2b003036773d57cc70d2c275 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 7 Mar 2007 08:55:42 -0700 Subject: [PATCH] additional error detection --- src/mesa/shader/slang/slang_codegen.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 26be14a0565..b2c9c727104 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -2077,6 +2077,10 @@ _slang_gen_field(slang_assemble_ctx * A, slang_operation *oper) GLint size = 4; /* XXX fix? */ base = _slang_gen_operation(A, &oper->children[0]); + if (!base) { + /* error previously found */ + return NULL; + } n = new_node1(IR_FIELD, base); if (n) { @@ -2118,6 +2122,7 @@ _slang_gen_subscript(slang_assemble_ctx * A, slang_operation *oper) if (oper->children[1].type != SLANG_OPER_LITERAL_INT || index >= max) { slang_info_log_error(A->log, "Invalid array index for vector type"); + return NULL; } n = _slang_gen_operation(A, &oper->children[0]); @@ -2143,7 +2148,11 @@ _slang_gen_subscript(slang_assemble_ctx * A, slang_operation *oper) slang_typeinfo_construct(&elem_ti); _slang_typeof_operation(A, oper, &elem_ti); elemSize = _slang_sizeof_type_specifier(&elem_ti.spec); - assert(elemSize >= 1); + if (elemSize <= 0) { + /* unknown var or type */ + slang_info_log_error(A->log, "Undefined var or type"); + return NULL; + } array = _slang_gen_operation(A, &oper->children[0]); index = _slang_gen_operation(A, &oper->children[1]); -- 2.30.2