Fixing segfault with mismatching set &default in record field.

This commit is contained in:
Robin Sommer 2013-12-18 08:36:50 -08:00
parent 207b7e7102
commit ae9e0d4cb6
5 changed files with 19 additions and 3 deletions

View file

@ -1,4 +1,9 @@
2.2-75 | 2013-12-18 08:36:50 -0800
* Fixing segfault with mismatching set &default in record fields.
(Robin Sommer)
2.2-74 | 2013-12-16 08:49:55 -0800
* Improve warnings emitted from raw/execute input reader. (Jon

View file

@ -1 +1 @@
2.2-74
2.2-75

View file

@ -317,8 +317,9 @@ void Attributes::CheckAttr(Attr* a)
break;
// Table defaults may be promotable.
if ( (ytype->Tag() == TYPE_RECORD && atype->Tag() == TYPE_RECORD &&
record_promotion_compatible(atype->AsRecordType(), ytype->AsRecordType())) )
if ( ytype && ytype->Tag() == TYPE_RECORD &&
atype->Tag() == TYPE_RECORD &&
record_promotion_compatible(atype->AsRecordType(), ytype->AsRecordType()) )
// Ok.
break;

View file

@ -0,0 +1 @@
error in /home/robin/bro/master/testing/btest/.tmp/language.record-default-set-mismatch/record-default-set-mismatch.bro, line 5: &default value has inconsistent type (&default=set(1, 2, 3))

View file

@ -0,0 +1,9 @@
# @TEST-EXEC-FAIL: bro -b %INPUT 2>out
# @TEST-EXEC: btest-diff out
type Foo: record {
a: set[string] &default=set(1,2,3);
};
global f: Foo;
print f;