diff options
author | 2019-10-22 11:11:24 -0700 | |
---|---|---|
committer | 2019-10-22 11:11:24 -0700 | |
commit | b816473ff8ccd1ab294eb167b26ae8ee6c08113f (patch) | |
tree | 86d3fe9e6f8df8ba17924fd4635265c62b61a70f /projects | |
parent | dd51826da58d329f53749aec811cb82ccffe241d (diff) |
Implement a fuzz target for uncompress2 in zlib. (#2976)
Diffstat (limited to 'projects')
-rw-r--r-- | projects/zlib/uncompress2_fuzzer.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/projects/zlib/uncompress2_fuzzer.cc b/projects/zlib/uncompress2_fuzzer.cc new file mode 100644 index 00000000..28e8d185 --- /dev/null +++ b/projects/zlib/uncompress2_fuzzer.cc @@ -0,0 +1,16 @@ +#include <stddef.h> +#include <stdint.h> +#include <string.h> + +#include "zlib.h" + +static Bytef buffer[256 * 1024] = { 0 }; + +// Entry point for LibFuzzer. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + uLongf buffer_length = static_cast<uLongf>(sizeof(buffer)); + uLong buf_size = static_cast<uLong>(size); + // Ignore return code. + uncompress2(buffer, &buffer_length, data, &buf_size); + return 0; +} |