Skip to content

Commit fef8114

Browse files
committed
Add out-of-bounds assertions
1 parent a018347 commit fef8114

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

spirv_cross_parsed_ir.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,8 @@ void ParsedIR::reset_all_of_type(Types type)
928928

929929
void ParsedIR::add_typed_id(Types type, ID id)
930930
{
931+
assert(id < ids.size());
932+
931933
if (loop_iteration_depth_hard != 0)
932934
SPIRV_CROSS_THROW("Cannot add typed ID while looping over it.");
933935

@@ -1030,6 +1032,8 @@ ParsedIR::LoopLock &ParsedIR::LoopLock::operator=(LoopLock &&other) SPIRV_CROSS_
10301032

10311033
void ParsedIR::make_constant_null(uint32_t id, uint32_t type, bool add_to_typed_id_set)
10321034
{
1035+
assert(id < ids.size());
1036+
10331037
auto &constant_type = get<SPIRType>(type);
10341038

10351039
if (constant_type.pointer)

0 commit comments

Comments
 (0)