summaryrefslogtreecommitdiff
path: root/tests/fuzz_parse.cpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-02-11 13:51:39 -0800
committerGitHub <noreply@github.com>2017-02-11 13:51:39 -0800
commit03e4b8de929328eb5cbb031ff535c50396d43bb9 (patch)
tree0552947207245d263abffb91e1c6b1d92b86e653 /tests/fuzz_parse.cpp
parent02c599f52b8817916405b4263da3616a55f77632 (diff)
parentec984370fb525d0cbc20b009f69c9c5eaec022a7 (diff)
Merge pull request #132 from zeux/fuzz
Improve fuzzing support
Diffstat (limited to 'tests/fuzz_parse.cpp')
-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;
}