Bug 700947: Add missing ENDTRY opcode in try/catch/finally byte code.

In one of the code branches in handling exceptions in the catch block
we forgot to call the ENDTRY opcode to pop the inner hidden try.
This leads to an unbalanced exception stack which can cause a crash
due to us jumping to a stack frame that has already been exited.
This commit is contained in:
Tor Andersson
2019-04-04 12:03:02 +02:00
parent da632ca08f
commit 1e5479084b

View File

@@ -1023,6 +1023,7 @@ static void ctrycatchfinally(JF, js_Ast *trystm, js_Ast *catchvar, js_Ast *catch
emitstring(J, F, OP_CATCH, catchvar->string); emitstring(J, F, OP_CATCH, catchvar->string);
cstm(J, F, catchstm); cstm(J, F, catchstm);
emit(J, F, OP_ENDCATCH); emit(J, F, OP_ENDCATCH);
emit(J, F, OP_ENDTRY);
L3 = emitjump(J, F, OP_JUMP); /* skip past the try block to the finally block */ L3 = emitjump(J, F, OP_JUMP); /* skip past the try block to the finally block */
} }
label(J, F, L1); label(J, F, L1);