mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 18:48:20 +00:00
Merge remote-tracking branch 'origin/topic/robin/event-args'
* origin/topic/robin/event-args: Fix assignments to event arguments becoming visible to subsequent handlers.
This commit is contained in:
commit
57b3e21de7
6 changed files with 48 additions and 6 deletions
23
src/Func.cc
23
src/Func.cc
|
@ -383,11 +383,7 @@ Val* BroFunc::Call(val_list* args, Frame* parent) const
|
|||
FType()->FlavorString().c_str(), d.Description());
|
||||
}
|
||||
|
||||
loop_over_list(*args, i)
|
||||
f->SetElement(i, (*args)[i]);
|
||||
|
||||
stmt_flow_type flow = FLOW_NEXT;
|
||||
|
||||
Val* result = 0;
|
||||
|
||||
for ( size_t i = 0; i < bodies.size(); ++i )
|
||||
|
@ -397,6 +393,20 @@ Val* BroFunc::Call(val_list* args, Frame* parent) const
|
|||
bodies[i].stmts->GetLocationInfo());
|
||||
|
||||
Unref(result);
|
||||
|
||||
loop_over_list(*args, j)
|
||||
{
|
||||
Val* arg = (*args)[j];
|
||||
|
||||
if ( f->NthElement(j) != arg )
|
||||
{
|
||||
// Either not yet set, or somebody reassigned
|
||||
// the frame slot.
|
||||
Ref(arg);
|
||||
f->SetElement(j, arg);
|
||||
}
|
||||
}
|
||||
|
||||
f->Reset(args->length());
|
||||
|
||||
try
|
||||
|
@ -434,6 +444,11 @@ Val* BroFunc::Call(val_list* args, Frame* parent) const
|
|||
}
|
||||
}
|
||||
|
||||
// We have an extra Ref for each argument (so that they don't get
|
||||
// deleted between bodies), release that.
|
||||
loop_over_list(*args, k)
|
||||
Unref((*args)[k]);
|
||||
|
||||
if ( Flavor() == FUNC_FLAVOR_HOOK )
|
||||
{
|
||||
if ( ! result )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue