summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorMarcos Pividori <mpividori@google.com>2017-02-08 00:02:32 +0000
committerMarcos Pividori <mpividori@google.com>2017-02-08 00:02:32 +0000
commit638ede81af3a46ab5e038f7d63583afff0c9cd2d (patch)
tree7df4f68d3a1becd227f8443afa41ef85ac7bb67c /llvm
parent51f907f3a4a9059f6847d8b70a2f29ba0fd96215 (diff)
downloadbcm5719-llvm-638ede81af3a46ab5e038f7d63583afff0c9cd2d.tar.gz
bcm5719-llvm-638ede81af3a46ab5e038f7d63583afff0c9cd2d.zip
[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 llvm-svn: 294378
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Fuzzer/test/LoadTest.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Fuzzer/test/LoadTest.cpp b/llvm/lib/Fuzzer/test/LoadTest.cpp
index c1780d5c7bd..eef16c7be51 100644
--- a/llvm/lib/Fuzzer/test/LoadTest.cpp
+++ b/llvm/lib/Fuzzer/test/LoadTest.cpp
@@ -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;
OpenPOWER on IntegriCloud