Merge remote-tracking branch 'origin/topic/johanna/bit-1519'

BIT-1519 #merged

* origin/topic/johanna/bit-1519:
  Fix crash when deleting non existing record member.
This commit is contained in:
Robin Sommer 2016-01-15 10:12:49 -08:00
commit 942b140fe5
3 changed files with 20 additions and 0 deletions

View file

@ -994,6 +994,9 @@ bool AddStmt::DoUnserialize(UnserialInfo* info)
DelStmt::DelStmt(Expr* arg_e) : ExprStmt(STMT_DELETE, arg_e)
{
if ( e->IsError() )
return;
if ( ! e->CanDel() )
Error("illegal delete statement");
}

View file

@ -0,0 +1,2 @@
error in /Users/johanna/bro/master/testing/btest/.tmp/language.undefined-delete-field/undefined-delete-field.bro, line 14: no such field in record (x$c)
1

View file

@ -0,0 +1,15 @@
# @TEST-EXEC: bro -b %INPUT >output 2>&1 || echo $? >>output
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff output
type MyRecordType: record
{
a: count;
b: count;
};
event bro_init()
{
local x = MyRecordType($a=1, $b=2);
delete x$c;
}