test: add fuzzers and support for fuzzing testing
There is a number of bugs related to parsing and encoding/decoding data. Examples: - csv: #2692, #4497, #2692 - uri: #585 One of the effective method to find such issues is a fuzzing testing. Patch introduces a CMake flag to enable building fuzzers (ENABLE_FUZZER) and add fuzzers based on LibFuzzer [1] to csv, http_parser and uri modules. Note that fuzzers must return 0 exit code only, other exit codes are not supported [2]. NOTE: LibFuzzer requires Clang compiler. 1. https://llvm.org/docs/LibFuzzer.html 2. http://llvm.org/docs/LibFuzzer.html#id22 How-To Use: $ mkdir build && cd build $ cmake -DENABLE_FUZZER=ON \ -DENABLE_ASAN=ON \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_C_COMPILER="/usr/bin/clang" \ -DCMAKE_CXX_COMPILER="/usr/bin/clang++" .. $ make -j $ ./test/fuzz/csv_fuzzer -workers=4 ../test/static/corpus/csv Part of #1809
Showing
- CMakeLists.txt 1 addition, 1 deletionCMakeLists.txt
- cmake/profile.cmake 15 additions, 0 deletionscmake/profile.cmake
- test/CMakeLists.txt 3 additions, 0 deletionstest/CMakeLists.txt
- test/fuzz/CMakeLists.txt 36 additions, 0 deletionstest/fuzz/CMakeLists.txt
- test/fuzz/csv_fuzzer.c 23 additions, 0 deletionstest/fuzz/csv_fuzzer.c
- test/fuzz/http_parser_fuzzer.c 19 additions, 0 deletionstest/fuzz/http_parser_fuzzer.c
- test/fuzz/uri_fuzzer.c 19 additions, 0 deletionstest/fuzz/uri_fuzzer.c
Loading
Please register or sign in to comment