Fix frame size allocation of alternate event/hook handlers

When the only existing handler doesn't use the full argument list, still
have to ensure the full frame is allocated because all arguments get set
regardless.
This commit is contained in:
Jon Siwek 2020-04-09 22:05:34 -07:00
parent 070b28ac05
commit 9243341e8c
3 changed files with 20 additions and 1 deletions

View file

@ -449,6 +449,11 @@ void BroFunc::AddBody(IntrusivePtr<Stmt> new_body, id_list* new_inits,
if ( new_frame_size > frame_size )
frame_size = new_frame_size;
auto num_args = FType()->Args()->NumFields();
if ( num_args > static_cast<int>(frame_size) )
frame_size = num_args;
new_body = AddInits(std::move(new_body), new_inits);
if ( Flavor() == FUNC_FLAVOR_FUNCTION )