Added runtime check for negative array indices in VM
https://forum.zdoom.org/viewtopic.php?t=57886
This commit is contained in:
parent
57de598e48
commit
81ea9fb372
2 changed files with 18 additions and 3 deletions
|
|
@ -899,6 +899,11 @@ static int Exec(VMFrameStack *stack, const VMOP *pc, VMReturn *ret, int numret)
|
|||
ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Max.index = %u, current index = %u\n", BC, reg.d[a]);
|
||||
return 0;
|
||||
}
|
||||
else if (reg.d[a] < 0)
|
||||
{
|
||||
ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Negative current index = %i\n", reg.d[a]);
|
||||
return 0;
|
||||
}
|
||||
NEXTOP;
|
||||
|
||||
OP(BOUND_K):
|
||||
|
|
@ -908,6 +913,11 @@ static int Exec(VMFrameStack *stack, const VMOP *pc, VMReturn *ret, int numret)
|
|||
ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Max.index = %u, current index = %u\n", konstd[BC], reg.d[a]);
|
||||
return 0;
|
||||
}
|
||||
else if (reg.d[a] < 0)
|
||||
{
|
||||
ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Negative current index = %i\n", reg.d[a]);
|
||||
return 0;
|
||||
}
|
||||
NEXTOP;
|
||||
|
||||
OP(BOUND_R):
|
||||
|
|
@ -917,6 +927,11 @@ static int Exec(VMFrameStack *stack, const VMOP *pc, VMReturn *ret, int numret)
|
|||
ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Max.index = %u, current index = %u\n", reg.d[B], reg.d[a]);
|
||||
return 0;
|
||||
}
|
||||
else if (reg.d[a] < 0)
|
||||
{
|
||||
ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Negative current index = %i\n", reg.d[a]);
|
||||
return 0;
|
||||
}
|
||||
NEXTOP;
|
||||
|
||||
OP(CONCAT):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue