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:
Bernhard Amann 2012-07-26 21:51:29 -07:00
parent 76ea182387
commit f02ed65878
2 changed files with 12 additions and 18 deletions

View file

@ -1544,7 +1544,7 @@ bool Manager::Delete(ReaderFrontend* reader, Value* *vals)
bool Manager::CallPred(Func* pred_func, const int numvals, ...) bool Manager::CallPred(Func* pred_func, const int numvals, ...)
{ {
bool result; bool result = false;
val_list vl(numvals); val_list vl(numvals);
va_list lP; va_list lP;
@ -1555,8 +1555,11 @@ bool Manager::CallPred(Func* pred_func, const int numvals, ...)
va_end(lP); va_end(lP);
Val* v = pred_func->Call(&vl); Val* v = pred_func->Call(&vl);
result = v->AsBool(); if ( v )
Unref(v); {
result = v->AsBool();
Unref(v);
}
return(result); return(result);
} }

View file

@ -686,16 +686,13 @@ bool Manager::Write(EnumVal* id, RecordVal* columns)
int result = 1; int result = 1;
try Val* v = filter->pred->Call(&vl);
if ( v )
{ {
Val* v = filter->pred->Call(&vl);
result = v->AsBool(); result = v->AsBool();
Unref(v); Unref(v);
} }
catch ( InterpreterException& e )
{ /* Already reported. */ }
if ( ! result ) if ( ! result )
continue; continue;
} }
@ -726,12 +723,9 @@ bool Manager::Write(EnumVal* id, RecordVal* columns)
Val* v = 0; Val* v = 0;
try v = filter->path_func->Call(&vl);
{
v = filter->path_func->Call(&vl);
}
catch ( InterpreterException& e ) if ( !v )
{ {
return false; return false;
} }
@ -1381,16 +1375,13 @@ bool Manager::FinishedRotation(WriterFrontend* writer, const char* new_name, con
int result = 0; int result = 0;
try Val* v = func->Call(&vl);
if ( v )
{ {
Val* v = func->Call(&vl);
result = v->AsBool(); result = v->AsBool();
Unref(v); Unref(v);
} }
catch ( InterpreterException& e )
{ /* Already reported. */ }
return result; return result;
} }