Skip to content

Commit

Permalink
Bug 700947: Add missing ENDTRY opcode in try/catch/finally byte code.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ccxvii committed Apr 4, 2019
1 parent da632ca commit 1e54790
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions jscompile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,7 @@ static void ctrycatchfinally(JF, js_Ast *trystm, js_Ast *catchvar, js_Ast *catch
emitstring(J, F, OP_CATCH, catchvar->string);
cstm(J, F, catchstm);
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 */
}
label(J, F, L1);
Expand Down

0 comments on commit 1e54790

Please # to comment.