mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 17:40:39 +00:00
Clamp value index by number of values
* This can be out of bounds when purely considering the instruction index if there's an instruction near the end, beyond the point where there are (many) further values.
This commit is contained in:
@@ -754,7 +754,7 @@ const Constant *ProgramEditor::GetOrAddConstant(Function *f, const Constant &c)
|
||||
|
||||
Instruction *ProgramEditor::AddInstruction(Function *f, size_t idx, const Instruction &inst)
|
||||
{
|
||||
size_t valueIdx = f->constants.size() + idx;
|
||||
size_t valueIdx = RDCMIN(f->values.size() - 1, f->constants.size() + idx);
|
||||
if(inst.type != m_VoidType)
|
||||
{
|
||||
// find the value index for the instruction we're inserting before. This won't match up exactly
|
||||
|
||||
Reference in New Issue
Block a user