mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 02:58:20 +00:00
Fix special-case-bug for vectors in UnaryExpr.
In some cases one can get the Type() of unaryexpr to be ANY. Vectors so far did not deal gracefully with this and crashed because trying to convert any to a vectortype. This patch fixes this by just using the original vector-type in this case.
This commit is contained in:
parent
da58f9d4a6
commit
12add53131
2 changed files with 26 additions and 1 deletions
|
@ -456,7 +456,13 @@ Val* UnaryExpr::Eval(Frame* f) const
|
|||
if ( is_vector(v) )
|
||||
{
|
||||
VectorVal* v_op = v->AsVectorVal();
|
||||
VectorVal* result = new VectorVal(Type()->AsVectorType());
|
||||
VectorType* out_t;
|
||||
if ( Type()->Tag() == TYPE_ANY )
|
||||
out_t = v->Type()->AsVectorType();
|
||||
else
|
||||
out_t = Type()->AsVectorType();
|
||||
|
||||
VectorVal* result = new VectorVal(out_t);
|
||||
|
||||
for ( unsigned int i = 0; i < v_op->Size(); ++i )
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue