mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 04:28:20 +00:00
Add checks to avoid improper negative values use.
This commit is contained in:
parent
a3b963ad4e
commit
a316878d01
12 changed files with 89 additions and 62 deletions
10
src/Val.cc
10
src/Val.cc
|
@ -2670,6 +2670,16 @@ Val* RecordVal::LookupWithDefault(int field) const
|
|||
return record_type->FieldDefault(field);
|
||||
}
|
||||
|
||||
Val* RecordVal::Lookup(const char* field, bool with_default) const
|
||||
{
|
||||
int idx = record_type->FieldOffset(field);
|
||||
|
||||
if ( idx < 0 )
|
||||
reporter->InternalError("missing record field: %s", field);
|
||||
|
||||
return with_default ? LookupWithDefault(idx) : Lookup(idx);
|
||||
}
|
||||
|
||||
RecordVal* RecordVal::CoerceTo(const RecordType* t, Val* aggr, bool allow_orphaning) const
|
||||
{
|
||||
if ( ! record_promotion_compatible(t->AsRecordType(), Type()->AsRecordType()) )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue