mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Format tables indexed by patterns consistently across 32-bit/64-bit
Uses a full 64 bit integer for length values regardless of actual size_t to get consistent results between either 32-bit and 64-bit platforms.
This commit is contained in:
parent
a8e137a879
commit
8e353aafe5
1 changed files with 4 additions and 4 deletions
|
@ -156,10 +156,10 @@ char* CompositeHash::SingleValHash(int type_check, char* kp0,
|
|||
v->AsPattern()->AnywherePatternText()
|
||||
};
|
||||
|
||||
size_t* kp;
|
||||
uint64_t* kp;
|
||||
for ( int i = 0; i < 2; i++ )
|
||||
{
|
||||
kp = AlignAndPadType<size_t>(kp0+i);
|
||||
kp = AlignAndPadType<uint64_t>(kp0+i);
|
||||
*kp = strlen(texts[i]) + 1;
|
||||
}
|
||||
|
||||
|
@ -507,7 +507,7 @@ int CompositeHash::SingleTypeKeySize(BroType* bt, const Val* v,
|
|||
if ( ! v )
|
||||
return (optional && ! calc_static_size) ? sz : 0;
|
||||
|
||||
sz = SizeAlign(sz, 2 * sizeof(size_t));
|
||||
sz = SizeAlign(sz, 2 * sizeof(uint64_t));
|
||||
sz += strlen(v->AsPattern()->PatternText())
|
||||
+ strlen(v->AsPattern()->AnywherePatternText()) + 2; // 2 for null terminators
|
||||
break;
|
||||
|
@ -894,7 +894,7 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
|
|||
}
|
||||
else
|
||||
{
|
||||
const size_t* const len = AlignType<size_t>(kp0);
|
||||
const uint64_t* const len = AlignType<uint64_t>(kp0);
|
||||
|
||||
kp1 = reinterpret_cast<const char*>(len+2);
|
||||
re = new RE_Matcher(kp1, kp1 + len[0]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue