open62541/tests/fuzz
2022-03-31 22:08:55 +02:00
..
fuzz_binary_message_corpus/generated ci: Correctly name fuzz corpus to avoid name clash 2019-10-10 10:28:03 +02:00
fuzz_json JSON: Add encoding/decoding fuzzing 2019-01-03 00:05:00 +01:00
check_build.sh Fuzz: Add check_build script to verify successful build 2019-05-06 14:55:48 +02:00
CMakeLists.txt fix(build): Fix building for oss-fuzz 2021-07-17 18:39:29 +02:00
corpus_generator.c fix(tests): Make tests less verbose 2020-11-25 16:04:48 +01:00
custom_memory_manager.c fix(core): Remove double ";" at end of line (#3938) 2020-10-06 10:47:07 +02:00
custom_memory_manager.h Move header files to a more unix-like structure 2019-03-21 20:16:31 +01:00
fuzz_base64_decode.cc ci(fuzz): Add fuzzing for base64 encoding and decoding 2019-11-07 19:28:33 +01:00
fuzz_base64_encode.cc ci(fuzz): Add fuzzing for base64 encoding and decoding 2019-11-07 19:28:33 +01:00
fuzz_binary_decode.cc fix(tests): Update fuzzing tests to the public encoding functions 2021-10-06 18:49:48 +02:00
fuzz_binary_message_header.dict Fuzz: Correct path to dicts 2018-11-17 21:15:24 +01:00
fuzz_binary_message.cc refactor(tests): Use C idioms in fuzz_binary_message.cc for consistency 2020-11-28 14:51:47 +01:00
fuzz_binary_message.options Fuzz: Correct path to dicts 2018-11-17 21:15:24 +01:00
fuzz_json_decode_encode.cc fix(core): Allow out-of-memory during fuzzing (2nd try) 2022-03-31 22:08:55 +02:00
fuzz_json_decode.cc fix(tests): Update fuzzing tests to the public encoding functions 2021-10-06 18:49:48 +02:00
fuzz_src_ua_util_endpoints.dict Fuzz: Correct path to dicts 2018-11-17 21:15:24 +01:00
fuzz_src_ua_util.cc ci(fuzz): Add author to license header 2019-11-07 19:28:33 +01:00
fuzz_src_ua_util.options Fuzz: Correct path to dicts 2018-11-17 21:15:24 +01:00
fuzz_tcp_message.cc fix(tests): Make tests less verbose 2020-11-25 16:04:48 +01:00
generate_corpus.sh fix(tests): Make tests less verbose 2020-11-25 16:04:48 +01:00
oss-fuzz-copy.sh ci: Add tcp_fuzz_message fuzzer 2019-10-14 15:59:05 +02:00
README.md Fuzz: Add check_build script to verify successful build 2019-05-06 14:55:48 +02:00
ua_debug_dump_pkgs_file.c refactor(core): Don't generate headers with internal encoding functions 2021-08-16 10:21:51 +02:00

I Can haz fuzz

open62541 is continuously tested with the awesome oss-fuzz project from Google: https://github.com/google/oss-fuzz

Currently tested is processing of binary messages and encoding/decoding of binary encoded data.

Reproduce locally

Reproduce build failure

You can just execute the script under tests/fuzz/check_build.sh, which does the following:

# clone oss-fuzz repo
cd oss-fuzz
# Change $OPEN62541_DIR to your local checkout of open62541
python infra/helper.py build_fuzzers --sanitizer address open62541 $OPEN62541_DIR && python infra/helper.py check_build --sanitizer address open62541

Reproduce issues

Download the testcase file and store it e.g. in your Download folder.

# clone oss-fuzz repo
cd oss-fuzz
# Change $OPEN62541_DIR to your local checkout of open62541
# And change $DOWNLOADS to your download location
python infra/helper.py build_fuzzers --sanitizer address open62541 $OPEN62541_DIR && python infra/helper.py reproduce open62541 fuzz_binary_decode $DOWNLOADS/clusterfuzz-testcase-minimized-fuzz_binary_decode-5686300273803264

Status

Update the corpus

To update the current corpus used for fuzzing you need to follow these steps. It will execute all the unit tests, dump the received data packages to a directory and then update and merge the corpus.

  1. The script will create two directories: open62541/build_fuzz and open62541/build_corpus. Make sure that these directories are not existing or do not contain any important data.

  2. Run the generate script:

    open62541/tests/fuzz/generate_corpus.sh

    This script will build all the unit tests, dump the packages and then merge the current corpus with the new packages.

  3. If there is new coverage with the generated data there will be new files in the directory:

    open62541/fuzz/fuzz_binary_message_corpus/generated

    Commit the new files and then you can delete the build directories created in step 1.