mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
fix for now-incorrect assumption that GetField always returns an existing ValPtr
This commit is contained in:
parent
f92946509c
commit
963d50bd48
1 changed files with 4 additions and 3 deletions
|
@ -184,7 +184,7 @@ char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
||||||
|
|
||||||
for ( int i = 0; i < num_fields; ++i )
|
for ( int i = 0; i < num_fields; ++i )
|
||||||
{
|
{
|
||||||
auto rv_i = rv->GetField(i).get();
|
auto rv_i = rv->GetField(i);
|
||||||
|
|
||||||
Attributes* a = rt->FieldDecl(i)->attrs.get();
|
Attributes* a = rt->FieldDecl(i)->attrs.get();
|
||||||
bool optional = (a && a->Find(ATTR_OPTIONAL));
|
bool optional = (a && a->Find(ATTR_OPTIONAL));
|
||||||
|
@ -194,7 +194,7 @@ char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
||||||
|
|
||||||
if ( ! (kp = SingleValHash(type_check, kp,
|
if ( ! (kp = SingleValHash(type_check, kp,
|
||||||
rt->GetFieldType(i).get(),
|
rt->GetFieldType(i).get(),
|
||||||
rv_i, optional)) )
|
rv_i.get(), optional)) )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,8 +517,9 @@ int CompositeHash::SingleTypeKeySize(Type* bt, const Val* v,
|
||||||
Attributes* a = rt->FieldDecl(i)->attrs.get();
|
Attributes* a = rt->FieldDecl(i)->attrs.get();
|
||||||
bool optional = (a && a->Find(ATTR_OPTIONAL));
|
bool optional = (a && a->Find(ATTR_OPTIONAL));
|
||||||
|
|
||||||
|
auto rv_v = rv ? rv->GetField(i) : nullptr;
|
||||||
sz = SingleTypeKeySize(rt->GetFieldType(i).get(),
|
sz = SingleTypeKeySize(rt->GetFieldType(i).get(),
|
||||||
rv ? rv->GetField(i).get() : nullptr,
|
rv_v.get(),
|
||||||
type_check, sz, optional,
|
type_check, sz, optional,
|
||||||
calc_static_size);
|
calc_static_size);
|
||||||
if ( ! sz )
|
if ( ! sz )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue