diff options
author | Jason Ekstrand <[email protected]> | 2016-02-10 15:34:35 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-02-10 15:36:41 -0800 |
commit | ac04c6de2c3abd2def23c43ede2458e4a61f7f6d (patch) | |
tree | a3ed5f05e9f9ed0439fce49127c76b24290c8e7f /src/compiler | |
parent | 8179834030c85722824a2a4863e4d5c2d75f07eb (diff) |
nir/spirv: Assert that struct member ids are in-bounds
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/nir/spirv/spirv_to_nir.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/nir/spirv/spirv_to_nir.c b/src/compiler/nir/spirv/spirv_to_nir.c index 979357d67c8..544251f5a1f 100644 --- a/src/compiler/nir/spirv/spirv_to_nir.c +++ b/src/compiler/nir/spirv/spirv_to_nir.c @@ -379,6 +379,7 @@ vtn_handle_decoration(struct vtn_builder *b, SpvOp opcode, } struct member_decoration_ctx { + unsigned num_fields; struct glsl_struct_field *fields; struct vtn_type *type; }; @@ -453,6 +454,8 @@ struct_member_decoration_cb(struct vtn_builder *b, if (member < 0) return; + assert(member < ctx->num_fields); + switch (dec->decoration) { case SpvDecorationRelaxedPrecision: break; /* FIXME: Do nothing with this for now. */ @@ -671,6 +674,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode, } struct member_decoration_ctx ctx = { + .num_fields = num_fields, .fields = fields, .type = val->type }; |