nir/spirv: Assert that struct member ids are in-bounds

This commit is contained in:
Jason Ekstrand 2016-02-10 15:34:35 -08:00
parent 8179834030
commit ac04c6de2c
1 changed files with 4 additions and 0 deletions

View File

@ -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
};