diff --git a/CHANGES b/CHANGES index f4833caea4..bd27000d15 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,22 @@ +3.2.0-dev.159 | 2020-02-26 19:51:24 -0800 + + * Pop global frame stack on exception. (Johanna Amann, Corelight) + + When changing this code for 3.0.0, the code-flow changed significantly. + One of the changes lead to exception being re-thrown from Call - which + leads to the function cleanup not always being run. While the Unref of + the framepointer was (correctly) moved into the catch block, the global + frame stack was not cleaned up - and contains an invalid pointer after + encountering an interpreter exception. + + This small commit pops the stack and removes the framepointer that was + pushed onto it before re-throwing the exception. + + I also think that this change (re-throwing the exception) breaks the + Zeek debugger in significant ways (you cannot debug a script that causes + a Runtime error anymore). + 3.2.0-dev.157 | 2020-02-26 10:04:32 -0800 * IntrusivePtr: overload std::swap() (Max Kellermann) diff --git a/VERSION b/VERSION index c39a045b4a..a1cb4ac2a1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.2.0-dev.157 +3.2.0-dev.159 diff --git a/src/Func.cc b/src/Func.cc index 639d69f685..ce7367d649 100644 --- a/src/Func.cc +++ b/src/Func.cc @@ -395,6 +395,8 @@ Val* BroFunc::Call(val_list* args, Frame* parent) const // Already reported, but now determine whether to unwind further. if ( Flavor() == FUNC_FLAVOR_FUNCTION ) { + g_frame_stack.pop_back(); + call_stack.pop_back(); Unref(f); // Result not set b/c exception was thrown throw;