mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00
Return an empty vector if the indices for slicing don't make sense
This commit is contained in:
parent
0af79a7a16
commit
f1383d98c2
1 changed files with 1 additions and 2 deletions
|
@ -3112,7 +3112,7 @@ Val* IndexExpr::Fold(Val* v1, Val* v2) const
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int len = vect->Size();
|
int len = vect->Size();
|
||||||
VectorVal* result = nullptr;
|
VectorVal* result = new VectorVal(vect->Type()->AsVectorType());
|
||||||
|
|
||||||
bro_int_t first = get_slice_index(lv->Index(0)->CoerceToInt(), len);
|
bro_int_t first = get_slice_index(lv->Index(0)->CoerceToInt(), len);
|
||||||
bro_int_t last = get_slice_index(lv->Index(1)->CoerceToInt(), len);
|
bro_int_t last = get_slice_index(lv->Index(1)->CoerceToInt(), len);
|
||||||
|
@ -3120,7 +3120,6 @@ Val* IndexExpr::Fold(Val* v1, Val* v2) const
|
||||||
|
|
||||||
if ( sub_length >= 0 )
|
if ( sub_length >= 0 )
|
||||||
{
|
{
|
||||||
result = new VectorVal(vect->Type()->AsVectorType());
|
|
||||||
result->Resize(sub_length);
|
result->Resize(sub_length);
|
||||||
|
|
||||||
for ( int idx = first; idx < last; idx++ )
|
for ( int idx = first; idx < last; idx++ )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue