Fix loader crash when some unhalted exception happens during include

command execution.  In case of such unhandled exception, vmReset() inside
ficlExecC() flushes the VM state.  Attempt to return back to Forth after
that cause garbage dereference with unexpected results.  To avoid that
situation call vmThrow() directly instead of expecting Forth to do it.
This commit is contained in:
Alexander Motin 2012-10-26 16:32:20 +00:00
parent 9572684af7
commit f7203ece6d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=242145

View File

@ -132,6 +132,12 @@ bf_command(FICL_VM *vm)
result=BF_PARSE;
}
free(line);
/*
* If there was error during nested ficlExec(), we may no longer have
* valid environment to return. Throw all exceptions from here.
*/
if (result != 0)
vmThrow(vm, result);
/* This is going to be thrown!!! */
stackPushINT(vm->pStack,result);
}