shithub: libmujs

Download patch

ref: 1e5479084bc9852854feb1ba9bf68b52cd127e02
parent: da632ca08f240590d2dec786722ed08486ce1be6
author: Tor Andersson <tor.andersson@artifex.com>
date: Thu Apr 4 08:03:02 EDT 2019

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.

--- a/jscompile.c
+++ b/jscompile.c
@@ -1023,6 +1023,7 @@
 		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);