Fixing bug with nested record coercions.

This commit is contained in:
Robin Sommer 2011-04-22 18:07:29 -07:00
parent 386f9db140
commit 964060c32f
3 changed files with 26 additions and 0 deletions

View file

@ -2976,6 +2976,7 @@ RecordVal* RecordVal::CoerceTo(const RecordType* t, Val* aggr) const
Expr* rhs = new ConstExpr(Lookup(i)->Ref());
Expr* e = new RecordCoerceExpr(rhs, ar_t->FieldType(t_i)->AsRecordType());
ar->Assign(t_i, e->Eval(0));
continue;
}
ar->Assign(t_i, Lookup(i)->Ref());

View file

@ -0,0 +1 @@
[major=4, minor=4, minor2=<uninitialized>, addl=<uninitialized>]

View file

@ -0,0 +1,24 @@
# @TEST-EXEC: bro %INPUT >output 2>&1
# @TEST-EXEC: btest-diff output
type Version: record {
major: count &optional;
minor: count &optional;
minor2: count &optional;
addl: string &optional;
};
type Info: record {
name: string;
version: Version;
};
global matched_software: table[string] of Info = {
["OpenSSH_4.4"] = [$name="OpenSSH", $version=[$major=4,$minor=4]],
};
event bro_init()
{
for ( sw in matched_software )
print matched_software[sw]$version;
}