[llvm] r294378 - [libFuzzer] Update Load test to work on 32 bits.
Marcos Pividori via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 7 16:02:32 PST 2017
Author: mpividori
Date: Tue Feb 7 18:02:32 2017
New Revision: 294378
URL: http://llvm.org/viewvc/llvm-project?rev=294378&view=rev
Log:
[libFuzzer] Update Load test to work on 32 bits.
We should ensure the size of the variable `a` is 8 bytes. Otherwise, this
generates a stack buffer overflow inside the memcpy call in 32 bits machines.
(We write more bytes than the size of a, when it is 4 bytes)
Differential Revision: https://reviews.llvm.org/D29602
Modified:
llvm/trunk/lib/Fuzzer/test/LoadTest.cpp
Modified: llvm/trunk/lib/Fuzzer/test/LoadTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/LoadTest.cpp?rev=294378&r1=294377&r2=294378&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/LoadTest.cpp (original)
+++ llvm/trunk/lib/Fuzzer/test/LoadTest.cpp Tue Feb 7 18:02:32 2017
@@ -14,7 +14,7 @@ int array[kArraySize];
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
if (Size < 8) return 0;
- size_t a = 0;
+ uint64_t a = 0;
memcpy(&a, Data, 8);
Sink = array[a % (kArraySize + 1)];
return 0;
More information about the llvm-commits
mailing list