mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Fix crash when encountering an InterpreterException in a predicate in logging or input Framework.
Inputframework: did not contain any error handling for this case. Logging framework: tried to catch the interpreter-exception. However the exception already was caught by the call-function and not propagated. Instead, call returns a 0-pointer in this case, which lead to a segmentation fault.
This commit is contained in:
parent
76ea182387
commit
f02ed65878
2 changed files with 12 additions and 18 deletions
|
@ -1544,7 +1544,7 @@ bool Manager::Delete(ReaderFrontend* reader, Value* *vals)
|
|||
|
||||
bool Manager::CallPred(Func* pred_func, const int numvals, ...)
|
||||
{
|
||||
bool result;
|
||||
bool result = false;
|
||||
val_list vl(numvals);
|
||||
|
||||
va_list lP;
|
||||
|
@ -1555,8 +1555,11 @@ bool Manager::CallPred(Func* pred_func, const int numvals, ...)
|
|||
va_end(lP);
|
||||
|
||||
Val* v = pred_func->Call(&vl);
|
||||
if ( v )
|
||||
{
|
||||
result = v->AsBool();
|
||||
Unref(v);
|
||||
}
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
|
|
@ -686,16 +686,13 @@ bool Manager::Write(EnumVal* id, RecordVal* columns)
|
|||
|
||||
int result = 1;
|
||||
|
||||
try
|
||||
{
|
||||
Val* v = filter->pred->Call(&vl);
|
||||
if ( v )
|
||||
{
|
||||
result = v->AsBool();
|
||||
Unref(v);
|
||||
}
|
||||
|
||||
catch ( InterpreterException& e )
|
||||
{ /* Already reported. */ }
|
||||
|
||||
if ( ! result )
|
||||
continue;
|
||||
}
|
||||
|
@ -726,12 +723,9 @@ bool Manager::Write(EnumVal* id, RecordVal* columns)
|
|||
|
||||
Val* v = 0;
|
||||
|
||||
try
|
||||
{
|
||||
v = filter->path_func->Call(&vl);
|
||||
}
|
||||
|
||||
catch ( InterpreterException& e )
|
||||
if ( !v )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1381,16 +1375,13 @@ bool Manager::FinishedRotation(WriterFrontend* writer, const char* new_name, con
|
|||
|
||||
int result = 0;
|
||||
|
||||
try
|
||||
{
|
||||
Val* v = func->Call(&vl);
|
||||
if ( v )
|
||||
{
|
||||
result = v->AsBool();
|
||||
Unref(v);
|
||||
}
|
||||
|
||||
catch ( InterpreterException& e )
|
||||
{ /* Already reported. */ }
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue