Skip to content

Commit

Permalink
Merge pull request #2414 from tygyh/Add-out-of-bounds-assertions
Browse files Browse the repository at this point in the history
Add out-of-bounds assertions
  • Loading branch information
HansKristian-Work authored Nov 13, 2024
2 parents cc62898 + fef8114 commit 25ffa1e
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 25ffa1e

Please sign in to comment.