[Bro-Dev] #983: Deep typing bug
Bro Tracker
bro at tracker.bro.org
Tue Apr 30 11:48:38 PDT 2013
#983: Deep typing bug
----------------------+------------------------
Reporter: seth | Owner:
Type: Problem | Status: new
Priority: High | Milestone: Bro2.2
Component: Bro | Version: git/master
Resolution: | Keywords:
----------------------+------------------------
Comment (by jsiwek):
Replying to [ticket:983 seth]:
>
> This looks like an issue where the automatic typing is digging down one
layer (beyond the set to the first record) but then doesn't auto type the
record a layer deeper and gives an error.
It's less a problem with nested records as it is a problem with inlining
any record ctor as indices within a set/table ctor. E.g.:
{{{
print set([$max=5], [$min=2, $max=10]);
}}}
gives a "type error in initialization" since two different types are used
to index the set and there's not any code yet to resolve the ambiguity of
what to use for the overall type of the set. I think maybe an aggregate
record type should be used that's made from all fields of all indices, but
I've got some issues getting that to work right now.
A second problem comes from something like:
{{{
type MyRec: record {
min: count &optional;
max: count;
};
local myset: set[MyRec] = set([$max=5], [$max=2]);
}}}
Here, the set ctor is fine since the index types agree, but there's a
"type clash in assignment" since the type of the rhs doesn't match. I
think implementing coercion for non-empty tables/sets would fix this.
> This is kind of a major usability issue for the 2.2 release because of
how the vulnerable software version script works.
>
> Example script:
> {{{
> @load frameworks/software/vulnerable
> redef Software::vulnerable_versions += {
> ["Java"] = set([$max=[$major=1,$minor=6,$minor2=0,$minor3=43]],
> [$min=[$major=1,$minor=7],
$max=[$major=1,$minor=7,$minor2=0,$minor3=20]])
> };
> }}}
A workaround for now would be:
{{{
const one: Software::VulnerableVersionRange =
[$max=[$major=1,$minor=6,$minor2=0,$minor3=43]];
const two: Software::VulnerableVersionRange =
[$min=[$major=1,$minor=7],
$max=[$major=1,$minor=7,$minor2=0,$minor3=20]];
redef Software::vulnerable_versions += {
["Java"] = set(one, two)
};
}}}
--
Ticket URL: <http://tracker.bro.org/bro/ticket/983#comment:2>
Bro Tracker <http://tracker.bro.org/bro>
Bro Issue Tracker
More information about the bro-dev
mailing list