Skip to content

Commit

Permalink
Add out-of-bounds assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
tygyh committed Nov 12, 2024
1 parent a018347 commit b61c416
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions spirv_cross_parsed_ir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,8 @@ void ParsedIR::reset_all_of_type(Types type)

void ParsedIR::add_typed_id(Types type, ID id)
{
assert(id != ids.size());

if (loop_iteration_depth_hard != 0)
SPIRV_CROSS_THROW("Cannot add typed ID while looping over it.");

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

void ParsedIR::make_constant_null(uint32_t id, uint32_t type, bool add_to_typed_id_set)
{
assert(id != ids.size());

auto &constant_type = get<SPIRType>(type);

if (constant_type.pointer)
Expand Down

0 comments on commit b61c416

Please sign in to comment.