Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions hashmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,16 @@ static uint64_t xxh3(const void* data, size_t len, uint64_t seed) {
uint64_t hashmap_sip(const void *data, size_t len, uint64_t seed0,
uint64_t seed1)
{
uint8_t buf[8] = {0};
// If the input buffer is smaller than 8 bytes, copy it into a zero-padded
// local buffer to avoid out-of-bounds reads
if (len < 8) {
memset(buf, 0, sizeof(buf));
memcpy(buf, data, len);
len = 8;
data = buf;
}

return SIP64((uint8_t*)data, len, seed0, seed1);
}

Expand Down