diff --git a/tests/fuzzer_corpora/test_z85_decode_fuzzer.txt b/tests/fuzzer_corpora/test_z85_decode_fuzzer.txt new file mode 100644 index 00000000..69f90d1a --- /dev/null +++ b/tests/fuzzer_corpora/test_z85_decode_fuzzer.txt @@ -0,0 +1 @@ +46555a5a2d54414746555a5ad6514147ec \ No newline at end of file diff --git a/tests/test_z85_decode_fuzzer.cpp b/tests/test_z85_decode_fuzzer.cpp index c0a65010..db37d3ba 100644 --- a/tests/test_z85_decode_fuzzer.cpp +++ b/tests/test_z85_decode_fuzzer.cpp @@ -60,10 +60,21 @@ extern "C" int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size) #ifndef ZMQ_USE_FUZZING_ENGINE void test_bind_null_fuzzer () { - uint8_t buffer[32] = {0}; + uint8_t **data; + size_t *len, num_cases = 0; + if (fuzzer_corpus_encode ("tests/fuzzer_corpora/test_z85_decode_fuzzer.txt", + &data, &len, &num_cases) + != 0) + exit (77); - TEST_ASSERT_SUCCESS_ERRNO ( - LLVMFuzzerTestOneInput (buffer, sizeof (buffer))); + while (num_cases-- > 0) { + TEST_ASSERT_SUCCESS_ERRNO ( + LLVMFuzzerTestOneInput (data[num_cases], len[num_cases])); + free (data[num_cases]); + } + + free (data); + free (len); } int main (int argc, char **argv)