[PATCH] D46163: [DO NOT SUBMIT] Do strlen() while computing xxhash

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 28 02:54:35 PDT 2018


grimar added inline comments.


================
Comment at: llvm/lib/Support/xxhash.cpp:148
+    const uint64_t *R = (const uint64_t *)Q;
+    if (uint64_t X = (R[0] - 0x0101010101010101) & ~R[0] & 0x8080808080808080) {
+      Remaining = (__builtin_ffsl(X) >> 3) - 1;
----------------
btw, if you pass P=="ab\0" to this method,

then `R[0]` will read the rest 5 bytes of memory from out of bounds, no?


https://reviews.llvm.org/D46163





More information about the llvm-commits mailing list