Merge remote-tracking branch 'origin/topic/johanna/global_frame_stack'

Additionally changed to pop call_stack which tracks related data.

* origin/topic/johanna/global_frame_stack:
  Pop global frame stack on exception.
This commit is contained in:
Jon Siwek 2020-02-26 19:51:24 -08:00
commit 36557f3086
3 changed files with 21 additions and 1 deletions

18
CHANGES
View file

@ -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 3.2.0-dev.157 | 2020-02-26 10:04:32 -0800
* IntrusivePtr: overload std::swap() (Max Kellermann) * IntrusivePtr: overload std::swap() (Max Kellermann)

View file

@ -1 +1 @@
3.2.0-dev.157 3.2.0-dev.159

View file

@ -395,6 +395,8 @@ Val* BroFunc::Call(val_list* args, Frame* parent) const
// Already reported, but now determine whether to unwind further. // Already reported, but now determine whether to unwind further.
if ( Flavor() == FUNC_FLAVOR_FUNCTION ) if ( Flavor() == FUNC_FLAVOR_FUNCTION )
{ {
g_frame_stack.pop_back();
call_stack.pop_back();
Unref(f); Unref(f);
// Result not set b/c exception was thrown // Result not set b/c exception was thrown
throw; throw;