diff options
| author | Thurston Dang <thurston@google.com> | 2023-05-18 21:30:28 +0000 |
|---|---|---|
| committer | Thurston Dang <thurston@google.com> | 2023-05-19 06:37:45 +0000 |
| commit | 016e604f6e1680588160008ba10618f58097e57e (patch) | |
| tree | f34064c9ff44e59fe90bb7ebbfc924e988fb61ad /flang/lib/Frontend/CompilerInvocation.cpp | |
| parent | d1dc3e13a791fe1b99a341406b5dafec64750cb1 (diff) | |
| download | llvm-016e604f6e1680588160008ba10618f58097e57e.zip llvm-016e604f6e1680588160008ba10618f58097e57e.tar.gz llvm-016e604f6e1680588160008ba10618f58097e57e.tar.bz2 | |
sanitizer_common: guard the wcslen interceptor code with SANITIZER_INTERCEPT_WCSLEN
This patch adds the #if SANITIZER_INTERCEPT_ guard for wcslen, similarly to how all the other
functions are guarded. It was the only missing SANITIZER_INTERCEPT_ guard [1].
This missing guard was discovered while investigating the stage2/hwasan check failure of https://reviews.llvm.org/D150708 ("hwasan: lay groundwork for importing subset of sanitizer_common interceptors [NFC]"), that was seen in https://lab.llvm.org/buildbot/#/builders/236/builds/4069. llvm_build_hwasan/unittests/ADT/./ADTTests had crashed with a backtrace of:
...
A disassembly of the binary showed that wcslen interception was present (since it was not guarded by SANITIZER_INTERCEPT_WCSLEN); howver, since INIT_WCSLEN was not called, REAL(wcslen) was null, resulting in the null pointer dereference.
[1] I checked this using "egrep '^#[ ]*define[ ]+(INIT_.*)' sanitizer_common_interceptors.inc | tr -s ' ' | sed -r 's/^# /#/' | cut -d ' ' -f 2 | sort | uniq -c | grep -v '^[ ]*2[ ]'"
The other matches are {INIT_PTHREAD_SETNAME_NP, INIT_QSORT, INIT_SHA2_INTECEPTORS(LEN), INIT_TLS_GET_ADDR, INIT_WAIT4}, which all have good reasons for not having exactly two cases.
Differential Revision: https://reviews.llvm.org/D150909
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions
