mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
Fixing bug with nested record coercions.
This commit is contained in:
parent
386f9db140
commit
964060c32f
3 changed files with 26 additions and 0 deletions
|
@ -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());
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
[major=4, minor=4, minor2=<uninitialized>, addl=<uninitialized>]
|
24
testing/btest/language/record-recursive-coercion.bro
Normal file
24
testing/btest/language/record-recursive-coercion.bro
Normal 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue