[all-commits] [llvm/llvm-project] 72eac4: [xxHash] Don't trigger UB on empty StringRef

Benjamin Kramer via All-commits all-commits at lists.llvm.org
Wed Feb 8 03:55:46 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 72eac42f21c0f45a27f3eaaff9364cbb5189b9e4
      https://github.com/llvm/llvm-project/commit/72eac42f21c0f45a27f3eaaff9364cbb5189b9e4
  Author: Benjamin Kramer <benny.kra at googlemail.com>
  Date:   2023-02-08 (Wed, 08 Feb 2023)

  Changed paths:
    M llvm/lib/Support/xxhash.cpp
    M llvm/unittests/Support/xxhashTest.cpp

  Log Message:
  -----------
  [xxHash] Don't trigger UB on empty StringRef

This is quite silly, but casting to uintptr_t seems like the easiest
option to quiet ubsan.

llvm/lib/Support/xxhash.cpp:107:12: runtime error: applying non-zero offset 8 to null pointer
    #0 0x7fe3660404c0 in llvm::xxHash64(llvm::StringRef) llvm/lib/Support/xxhash.cpp:107:12




More information about the All-commits mailing list