Skip to content

MurmurHash3 has undefined behavior #26512

@Keno

Description

@Keno

Our implementation of MurmurHash3 has:

FORCE_INLINE uint64_t getblock64 ( const uint64_t * p, int i )
{
return p[i];
}

However, the pointer is not necessarily properly aligned, making this undefined behavior.
The proper fix is to stop casting to an invalid pointer type and to use memcpy, which all modern compiler optimize to a proper sequence for unaligned access.

This is the same issue as grpc/grpc#13221

Metadata

Metadata

Assignees

No one assigned

    Labels

    hashingupstreamThe issue is with an upstream dependency, e.g. LLVM

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions