[compiler-rt] b351590 - [libFuzzer] Fix fuzzer-oom.test.

Matt Morehouse via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 13 11:33:59 PDT 2021


Author: Matt Morehouse
Date: 2021-04-13T11:33:41-07:00
New Revision: b351590baed5472a0def984d9bb0b035cc1ae93c

URL: https://github.com/llvm/llvm-project/commit/b351590baed5472a0def984d9bb0b035cc1ae93c
DIFF: https://github.com/llvm/llvm-project/commit/b351590baed5472a0def984d9bb0b035cc1ae93c.diff

LOG: [libFuzzer] Fix fuzzer-oom.test.

SinkPtr was not correctly marked as volatile, causing the malloc to get
optimized out.  This was causing 20-minute timeouts for the test and no
OOM.

Added: 
    

Modified: 
    compiler-rt/test/fuzzer/OutOfMemorySingleLargeMallocTest.cpp
    compiler-rt/test/fuzzer/OutOfMemoryTest.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/fuzzer/OutOfMemorySingleLargeMallocTest.cpp b/compiler-rt/test/fuzzer/OutOfMemorySingleLargeMallocTest.cpp
index 5a6b49ff15900..301805de67746 100644
--- a/compiler-rt/test/fuzzer/OutOfMemorySingleLargeMallocTest.cpp
+++ b/compiler-rt/test/fuzzer/OutOfMemorySingleLargeMallocTest.cpp
@@ -10,7 +10,7 @@
 #include <cstring>
 #include <iostream>
 
-static volatile char *SinkPtr;
+static char *volatile SinkPtr;
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   if (Size > 0 && Data[0] == 'H') {

diff  --git a/compiler-rt/test/fuzzer/OutOfMemoryTest.cpp b/compiler-rt/test/fuzzer/OutOfMemoryTest.cpp
index ae8e6ee3b8ab2..546e26e2be730 100644
--- a/compiler-rt/test/fuzzer/OutOfMemoryTest.cpp
+++ b/compiler-rt/test/fuzzer/OutOfMemoryTest.cpp
@@ -11,7 +11,7 @@
 #include <iostream>
 #include <thread>
 
-static volatile char *SinkPtr;
+static char *volatile SinkPtr;
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   if (Size > 0 && Data[0] == 'H') {


        


More information about the llvm-commits mailing list