Right now there is an issue with pushing and popping exception handlers. Right now we only really handle two cases
try {
// stuff
// <- pop here
} catch {
// <- pop here
// stuff
}
At first this seems fine we pop the handler at the end of the try catch block and we pop it at the begin of the catch if an exception is handled. The issue is we can exit this block in other ways
try {
// stuff
return 10;
// <- pop here
} catch {
// <- pop here
// stuff
}
In this case we return prior to popping the exception handler.
Additional we have a similar case with continue and break
while true {
try {
// stuff
continue; // or break
// <- pop here
} catch {
// <- pop here
// stuff
}
}
Here continue is worse because we can build up a large number of exception handlers that never get popped. This issue materialized because we had a case where an inner exception handler wasn't popped because of a return. Later an exception was through inside the scope of another handler but the first handler was used and attempted to index out of bounds.
Problem
Right now there is an issue with pushing and popping exception handlers. Right now we only really handle two cases
At first this seems fine we pop the handler at the end of the try catch block and we pop it at the begin of the catch if an exception is handled. The issue is we can exit this block in other ways
In this case we return prior to popping the exception handler.
Additional we have a similar case with
continue
andbreak
Here continue is worse because we can build up a large number of exception handlers that never get popped. This issue materialized because we had a case where an inner exception handler wasn't popped because of a
return
. Later an exception was through inside the scope of another handler but the first handler was used and attempted to index out of bounds.