Found a weird bug, reporting it

This commit is contained in:
2022-08-20 13:44:55 +01:00
parent f5e060051e
commit daceaa5492
4 changed files with 16 additions and 9 deletions

View File

@@ -573,7 +573,7 @@ static bool execCompareLessEqual(Interpreter* interpreter, bool invert) {
static bool execJump(Interpreter* interpreter) {
int target = (int)readShort(interpreter->bytecode, &interpreter->count);
if (target >= interpreter->length) {
if (target + interpreter->codeStart > interpreter->length) {
printf("Jump out of range\n");
return false;
}
@@ -587,7 +587,7 @@ static bool execJump(Interpreter* interpreter) {
static bool execFalseJump(Interpreter* interpreter) {
int target = (int)readShort(interpreter->bytecode, &interpreter->count);
if (target >= interpreter->length) {
if (target + interpreter->codeStart > interpreter->length) {
printf("Jump out of range\n");
return false;
}