Merge branch 'topic/corelight/eval-condition-crash' of https://github.com/corelight/bro

* 'topic/corelight/eval-condition-crash' of https://github.com/corelight/bro:
  Fix segmentation fault on eval condition with no return value.
This commit is contained in:
Jon Siwek 2017-10-03 11:56:32 -05:00
commit e7d3dd0818
4 changed files with 34 additions and 2 deletions

View file

@ -175,9 +175,15 @@ bool RuleConditionEval::DoMatch(Rule* rule, RuleEndpointState* state,
try
{
Val* val = id->ID_Val()->AsFunc()->Call(&args);
if ( val )
{
result = val->AsBool();
Unref(val);
}
else
result = false;
}
catch ( InterpreterException& e )
{

View file

@ -0,0 +1,3 @@
1329843162.083353 warning: non-void function returns without a value: mark_conn
1329843164.920456 warning: non-void function returns without a value: mark_conn
1329843200.079930 warning: non-void function returns without a value: mark_conn

View file

@ -0,0 +1,3 @@
Called
Called
Called

View file

@ -0,0 +1,20 @@
# @TEST-EXEC: bro -r $TRACES/ftp/ipv4.trace %INPUT
# @TEST-EXEC: btest-diff .stdout
# @TEST-EXEC: btest-diff .stderr
@load-sigs blah.sig
@TEST-START-FILE blah.sig
signature blah
{
ip-proto == tcp
src-port == 21
payload /.*/
eval mark_conn
}
@TEST-END-FILE
function mark_conn(state: signature_state, data: string): bool
{
print "Called";
}