[2/2] glsl: Add an assert when cloning ir_dereference_record with invalid field

Submitted by Danylo Piliaiev on Aug. 15, 2018, 12:46 p.m.

Details

Message ID 20180815124639.12600-2-danylo.piliaiev@globallogic.com
State Accepted
Commit 18be7403a11f53d58bbfe3905c0cacd6bc714492
Headers show
Series "Series without cover letter" ( rev: 1 ) in Mesa

Browsing this patch as part of:
"Series without cover letter" rev 1 in Mesa
<< prev patch [2/2] next patch >>

Commit Message

Danylo Piliaiev Aug. 15, 2018, 12:46 p.m.
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
---
 src/compiler/glsl/ir_clone.cpp | 1 +
 1 file changed, 1 insertion(+)

Patch hide | download patch | download mbox

diff --git a/src/compiler/glsl/ir_clone.cpp b/src/compiler/glsl/ir_clone.cpp
index 69441fae7d..e1f4f3b290 100644
--- a/src/compiler/glsl/ir_clone.cpp
+++ b/src/compiler/glsl/ir_clone.cpp
@@ -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),