Commit 58e3caa4 authored by Lucian Grijincu's avatar Lucian Grijincu Committed by facebook-github-bot-1

folly: Hash: use loadUnassigned to avoid UB in hsieh_hash32_buf (fsanitize=alignment)

Reviewed By: philippv

Differential Revision: D2886152

fb-gh-sync-id: 64c3543db831c72c7f4cf307867223270293066e
parent 45bedee3
......@@ -25,6 +25,7 @@
#include <utility>
#include <folly/ApplyTuple.h>
#include <folly/Bits.h>
#include <folly/SpookyHashV1.h>
#include <folly/SpookyHashV2.h>
......@@ -277,7 +278,7 @@ inline uint64_t fnv64(const std::string& str,
* Paul Hsieh: http://www.azillionmonkeys.com/qed/hash.html
*/
#define get16bits(d) (*((const uint16_t*) (d)))
#define get16bits(d) folly::loadUnaligned<uint16_t>(d)
inline uint32_t hsieh_hash32_buf(const void* buf, size_t len) {
// forcing signed char, since other platforms can use unsigned
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment