crayon icon indicating copy to clipboard operation
crayon copied to clipboard

STACK CORRUPTION with continue in a catch block within a loop

Open blakeohare opened this issue 5 years ago • 0 comments

Repro:

function main(args) {
	for (num : [1, 2, 3]) {
		print(num);
		try {
			print("Try");
			throwOnEven(num);
		} catch(Exception e) {
			print("Catch");
			continue;
		}
		print("Post-try");
	}
	print("Done");
}

function throwOnEven(n) {
	if (n % 2 == 0) throw new Exception();
}

Result: "Done" is skipped on 3. After the catch is triggered, it seems the post-finally behavior for this scope is permanently modified to continue-after-finally (where finally is an implicit empty block in this case)

blakeohare avatar Oct 30 '19 00:10 blakeohare