mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 09:08:20 +00:00
Fix for a table refering to a expire function that's not defined.
I was hoping to report this right at startup through a static check but turns out we don't have the right machinery in place for that. That would need to be done after the AST has been finalized, but our AST traversal code can't iterate over types. So instead I've changed this so that it's still being reported at runtime but at least doesn't crash Bro anymore. Closes BIT-1597.
This commit is contained in:
parent
0fa9590902
commit
4f9cb6912a
5 changed files with 82 additions and 2 deletions
17
src/Val.cc
17
src/Val.cc
|
@ -2285,8 +2285,23 @@ double TableVal::CallExpireFunc(Val* idx)
|
|||
|
||||
try
|
||||
{
|
||||
Val* vs = expire_expr->Eval(0)->AsFunc()->Call(vl);
|
||||
Val* vf = expire_expr->Eval(0);
|
||||
|
||||
if ( ! vf )
|
||||
// Will have been reported already.
|
||||
return 0;
|
||||
|
||||
if ( vf->Type()->Tag() != TYPE_FUNC )
|
||||
{
|
||||
Unref(vf);
|
||||
vf->Error("not a function");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Val* vs = vf->AsFunc()->Call(vl);
|
||||
secs = vs->AsInterval();
|
||||
|
||||
Unref(vf);
|
||||
Unref(vs);
|
||||
delete vl;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue