[all-commits] [llvm/llvm-project] bde4ff: Don't pass null pointers to memcmp and memcpy in l...
David Benjamin via All-commits
all-commits at lists.llvm.org
Tue Aug 13 15:27:03 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: bde4ffe7521421cfa891c7d6e526566920326b3f
https://github.com/llvm/llvm-project/commit/bde4ffe7521421cfa891c7d6e526566920326b3f
Author: David Benjamin <davidben at google.com>
Date: 2024-08-13 (Tue, 13 Aug 2024)
Changed paths:
M compiler-rt/lib/fuzzer/FuzzerDictionary.h
M compiler-rt/lib/fuzzer/FuzzerLoop.cpp
Log Message:
-----------
Don't pass null pointers to memcmp and memcpy in libFuzzer (#96775)
In C, it is UB to call `memcmp(NULL, NULL, 0)`, `memcpy(NULL, NULL, 0)`,
etc. Unfortunately, `(NULL, 0)` is the natural representation of an
empty sequence of objects and extremely common in real world code. As a
result, all C code, and C++ code which calls into C functions, must
carefully guard all calls to `memcpy`.
This is a serious, real world usability issue in C and should be fixed
in the language (see #49459). In the meantime, pay the cost of the extra
branch to avoid tripping UBSan in libFuzzer. Once the usability problem
in C has been fixed, these checks can be removed.
Fixes #96772
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list