Skip to content

Commit

Permalink
[libFuzzer] Disable Msan on InternalStrnlen
Browse files Browse the repository at this point in the history
It's called from ATTRIBUTE_NO_SANITIZE_MEMORY code.
It worked as expected if inlined and complained otherwise.

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D113323
  • Loading branch information
vitalybuka committed Nov 5, 2021
1 parent 6278682 commit 3c7960c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler-rt/lib/fuzzer/FuzzerTracePC.cpp
Expand Up @@ -391,6 +391,7 @@ void TracePC::HandleCmp(uintptr_t PC, T Arg1, T Arg2) {
ValueProfileMap.AddValue(PC * 128 + 64 + AbsoluteDistance);
}

ATTRIBUTE_NO_SANITIZE_MEMORY
static size_t InternalStrnlen(const char *S, size_t MaxLen) {
size_t Len = 0;
for (; Len < MaxLen && S[Len]; Len++) {}
Expand All @@ -399,6 +400,7 @@ static size_t InternalStrnlen(const char *S, size_t MaxLen) {

// Finds min of (strlen(S1), strlen(S2)).
// Needed because one of these strings may actually be non-zero terminated.
ATTRIBUTE_NO_SANITIZE_MEMORY
static size_t InternalStrnlen2(const char *S1, const char *S2) {
size_t Len = 0;
for (; S1[Len] && S2[Len]; Len++) {}
Expand Down

0 comments on commit 3c7960c

Please sign in to comment.