diff --git a/vm/vm.cpp b/vm/vm.cpp index 6c90474..aa7a0f1 100644 --- a/vm/vm.cpp +++ b/vm/vm.cpp @@ -617,6 +617,10 @@ bool VM::execPOOP(void) { dst = as.code[regs[IP] + 1]; DBG_INFO(("POOP %s\n", getRegName(dst))); + if (regs[SP] - sizeof(uint16_t) < 0) { + DBG_ERROR(("Stack is going below 0!\n")); + return false; + } regs[SP] -= sizeof(uint16_t); memcpy(®s[dst], &as.stack[regs[SP]], sizeof(uint16_t)); return true;