From 15fba1debca5498989048677ffda38758b2df984 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Fri, 13 Mar 2015 00:18:30 -0700 Subject: tests: Add support for afl-fuzz With the current setup it successfully finds the (fixed) DOCTYPE buffer overrun in ~50 minutes (on a single core). --- tests/fuzz_parse.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/fuzz_parse.cpp (limited to 'tests/fuzz_parse.cpp') diff --git a/tests/fuzz_parse.cpp b/tests/fuzz_parse.cpp new file mode 100644 index 0000000..e758196 --- /dev/null +++ b/tests/fuzz_parse.cpp @@ -0,0 +1,16 @@ +#include "../src/pugixml.hpp" +#include "allocator.hpp" + +int main(int argc, const char** argv) +{ + pugi::set_memory_management_functions(memory_allocate, memory_deallocate); + + pugi::xml_document doc; + + for (int i = 1; i < argc; ++i) + { + doc.load_file(argv[i]); + doc.load_file(argv[i], pugi::parse_minimal); + doc.load_file(argv[i], pugi::parse_full); + } +} -- cgit v1.2.3