diff options
author | Kostya Serebryany <kcc@google.com> | 2017-01-20 21:34:24 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2017-01-20 21:34:24 +0000 |
commit | 87a3811d32643a481731bc3d31e9ca15e2a7dbd1 (patch) | |
tree | 9b565eb788c93d29bede1ce2bc585f526d332a8b /llvm/lib/Fuzzer/test/BogusInitializeTest.cpp | |
parent | f170504c419596b94a3cd0178b7caaccc0d20840 (diff) | |
download | bcm5719-llvm-87a3811d32643a481731bc3d31e9ca15e2a7dbd1.tar.gz bcm5719-llvm-87a3811d32643a481731bc3d31e9ca15e2a7dbd1.zip |
[libFuzzer] add an assert to protect against LLVMFuzzerInitialize changing argv[0]
llvm-svn: 292652
Diffstat (limited to 'llvm/lib/Fuzzer/test/BogusInitializeTest.cpp')
-rw-r--r-- | llvm/lib/Fuzzer/test/BogusInitializeTest.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/test/BogusInitializeTest.cpp b/llvm/lib/Fuzzer/test/BogusInitializeTest.cpp new file mode 100644 index 00000000000..c7e81a5478b --- /dev/null +++ b/llvm/lib/Fuzzer/test/BogusInitializeTest.cpp @@ -0,0 +1,15 @@ +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. + +// Make sure LLVMFuzzerInitialize does not change argv[0]. +#include <stddef.h> +#include <stdint.h> + +extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) { + ***argv = 'X'; + return 0; +} + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { + return 0; +} |