From 15fe5b74c46cbe12da26ef3c5543c5e0bd8d64c1 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sat, 28 Oct 2017 12:32:03 +0200 Subject: Trying libFuzzer --- testfiles/fuzzer.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 testfiles/fuzzer.cpp (limited to 'testfiles/fuzzer.cpp') diff --git a/testfiles/fuzzer.cpp b/testfiles/fuzzer.cpp new file mode 100644 index 000000000..6dd09e753 --- /dev/null +++ b/testfiles/fuzzer.cpp @@ -0,0 +1,15 @@ +#include "xml/repr.h" +#include "inkscape.h" +#include "document.h" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + g_type_init(); + Inkscape::GC::init(); + if ( !Inkscape::Application::exists() ) + Inkscape::Application::create("", false); + //void* a= sp_repr_read_mem((const char*)data, size, 0); + SPDocument *doc = SPDocument::createNewDocFromMem( (const char*)data, size, 0); + if(doc) + doc->doUnref(); + return 0; +} -- cgit v1.2.3