diff --git a/compiler-rt/test/fuzzer/LoadTest.cpp b/compiler-rt/test/fuzzer/LoadTest.cpp --- a/compiler-rt/test/fuzzer/LoadTest.cpp +++ b/compiler-rt/test/fuzzer/LoadTest.cpp @@ -9,15 +9,16 @@ #include #include -static volatile int Sink; -const int kArraySize = 1234567; -int array[kArraySize]; +static volatile uint8_t Sink; +const int kArraySize = 32505854; // 0x01effffe +uint8_t array[kArraySize]; extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { - if (Size < 8) return 0; + if (Size != 8) + return 0; uint64_t a = 0; - memcpy(&a, Data, 8); + memcpy(&a, Data, sizeof(a)); + a &= 0x1fffffff; Sink = array[a % (kArraySize + 1)]; return 0; } - diff --git a/compiler-rt/test/fuzzer/value-profile-load.test b/compiler-rt/test/fuzzer/value-profile-load.test --- a/compiler-rt/test/fuzzer/value-profile-load.test +++ b/compiler-rt/test/fuzzer/value-profile-load.test @@ -1,3 +1,3 @@ CHECK: AddressSanitizer: global-buffer-overflow RUN: %cpp_compiler %S/LoadTest.cpp -fsanitize-coverage=trace-gep -o %t-LoadTest -RUN: not %run %t-LoadTest -seed=2 -use_cmp=0 -use_value_profile=1 -runs=20000000 2>&1 | FileCheck %s +RUN: not %run %t-LoadTest -seed=1 -use_cmp=0 -use_value_profile=1 -runs=20000000 2>&1 | FileCheck %s