From 709b5971c68cd439b1b3bee874edfa0911f6c3ff Mon Sep 17 00:00:00 2001 From: belliash Date: Sun, 22 Dec 2019 22:40:11 +0100 Subject: [PATCH] Return can break loop execution as well. If it does, it needs to ensure VM_FRAME_ACTIVE is on top. --- engine/vm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engine/vm.c b/engine/vm.c index 4da19c7..80777f5 100644 --- a/engine/vm.c +++ b/engine/vm.c @@ -1901,6 +1901,12 @@ static sxi32 VmByteCodeExec( if(pLastRef) { *pLastRef = pTos->nIdx; } + /* Ensure we are in active loop. Force abort all loops */ + if(pVm->pFrame->iFlags & VM_FRAME_LOOP) { + while((pVm->pFrame->iFlags & VM_FRAME_ACTIVE) == 0) { + VmLeaveFrame(&(*pVm)); + } + } if(pResult) { /* Execution result */ PH7_MemObjStore(pTos, pResult);