summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-02-07 23:34:39 -0800
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-02-09 07:36:32 -0800
commit00ef791078ec318f663b0cffdb18fd928394d591 (patch)
treed18bd84cec695fecbe5066bf2937cbcc5954a291 /tests
parente748f435e5481b5a44686486e8f467823688b2c0 (diff)
fuzz: Use libFuzzer instead of afl-fuzz
This allows us to have faster fuzz cycles since the fuzzer is in-process.
Diffstat (limited to 'tests')
-rw-r--r--tests/fuzz_parse.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/tests/fuzz_parse.cpp b/tests/fuzz_parse.cpp
index e758196..94c610a 100644
--- a/tests/fuzz_parse.cpp
+++ b/tests/fuzz_parse.cpp
@@ -1,16 +1,14 @@
#include "../src/pugixml.hpp"
-#include "allocator.hpp"
-int main(int argc, const char** argv)
-{
- pugi::set_memory_management_functions(memory_allocate, memory_deallocate);
+#include <stdint.h>
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
+{
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);
- }
+ doc.load_buffer(Data, Size);
+ doc.load_buffer(Data, Size, pugi::parse_minimal);
+ doc.load_buffer(Data, Size, pugi::parse_full);
+
+ return 0;
}