diff options
author | Brian <[email protected]> | 2007-03-07 08:55:42 -0700 |
---|---|---|
committer | Brian <[email protected]> | 2007-03-07 08:55:42 -0700 |
commit | e61ec95deb6e7edb2b003036773d57cc70d2c275 (patch) | |
tree | facf771bb55ccbe6444a60b9b4151b559c6e6aac /src/mesa/shader/slang/slang_codegen.c | |
parent | cec81eef313cea94ffdbd8e62c18ff8d3f651dbd (diff) |
additional error detection
Diffstat (limited to 'src/mesa/shader/slang/slang_codegen.c')
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.c | 11 |
1 files changed, 10 insertions, 1 deletions
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]); |