Skip to content

Tests: Add a fuzzer for oss-fuzz

AdamKorcz requested to merge AdamKorcz/cmake:fuzz1 into master

This PR adds a fuzzer for the XML parser to setup continuous fuzzing of CMake through the OSS-fuzz platform.

For those unfamiliar: Fuzzing is a way of testing applications whereby pseudo-random data is passed to an entrypoint of a target application with the goal of uncovering bugs and vulnerabilities. In the case of the fuzzer in this PR the entrypoint is cmXMLParser::ParseFile. The fuzzer creates a test-file with the payload and parses that file. In order to help the fuzzer create valid XML a seed is provided - This can be found in the end of the build script on the OSS-fuzz side. The seed helps greatly with getting the fuzzer started.

OSS-fuzz is a project by Google that offers free resources and infrastructure for critical open source projects. If/when bugs are found all maintainers on the contact list is notified with an email containing a link to a detailed bug report with stack trace and reproducible test case. I will shortly be setting up the necessary files on the OSS-fuzz side. At that point all that is needed is for the files in this PR to be merged and then at least one maintainers email address. After that the fuzzer will run continuously by OSS-fuzz.

I will be happy to write more fuzzers for the CMake project. This will be easier once CMake is integrated both for myself and other developers as OSS-fuzz gives an overview of the coverage of all fuzzers. The location of the files in this PR are merely suggestions. Please feel free to suggest alternatives.

Edited by AdamKorcz

Merge request reports