glsl: Add an assert when cloning ir_dereference_record with invalid field
authorDanylo Piliaiev <danylo.piliaiev@gmail.com>
Wed, 15 Aug 2018 12:46:23 +0000 (15:46 +0300)
committerTimothy Arceri <tarceri@itsqueeze.com>
Wed, 19 Sep 2018 22:30:11 +0000 (08:30 +1000)
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/compiler/glsl/ir_clone.cpp

index 69441fae7de0e5eff396de2a94f110f6f65161de..e1f4f3b2903dd30697a44afb6301abbe956f9b14 100644 (file)
@@ -194,6 +194,7 @@ ir_dereference_array::clone(void *mem_ctx, struct hash_table *ht) const
 ir_dereference_record *
 ir_dereference_record::clone(void *mem_ctx, struct hash_table *ht) const
 {
+   assert(this->field_idx >= 0);
    const char *field_name =
       this->record->type->fields.structure[this->field_idx].name;
    return new(mem_ctx) ir_dereference_record(this->record->clone(mem_ctx, ht),