summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-01-12 11:25:24 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-01-12 12:25:39 +0000
commit1c364b96d3923a0b48b6494d002da45cd0a1e270 (patch)
tree8700cd8ececf6c27f3295e6c4698c018f6219eb0 /vcl
parent5d98a54058322a39cd7028ddfd0b27c97c8248d5 (diff)
add ppm/pbm fuzzer
Change-Id: I6f403570abcf50be4cf11f20ea52bb2a07367b2a
Diffstat (limited to 'vcl')
-rw-r--r--vcl/Executable_ppmfuzzer.mk47
-rw-r--r--vcl/Module_vcl.mk1
-rw-r--r--vcl/workben/ppmfuzzer.cxx24
3 files changed, 72 insertions, 0 deletions
diff --git a/vcl/Executable_ppmfuzzer.mk b/vcl/Executable_ppmfuzzer.mk
new file mode 100644
index 000000000000..07b87a29d4c0
--- /dev/null
+++ b/vcl/Executable_ppmfuzzer.mk
@@ -0,0 +1,47 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+include $(SRCDIR)/vcl/commonfuzzer.mk
+
+$(eval $(call gb_Executable_Executable,ppmfuzzer))
+
+$(eval $(call gb_Executable_use_api,ppmfuzzer,\
+ offapi \
+ udkapi \
+))
+
+$(eval $(call gb_Executable_use_externals,ppmfuzzer,\
+ $(fuzzer_externals) \
+))
+
+$(eval $(call gb_Executable_set_include,ppmfuzzer,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/vcl/inc \
+))
+
+$(eval $(call gb_Executable_use_libraries,ppmfuzzer,\
+ $(fuzzer_libraries) \
+))
+
+$(eval $(call gb_Executable_use_static_libraries,ppmfuzzer,\
+ findsofficepath \
+ ulingu \
+ fuzzer \
+))
+
+$(eval $(call gb_Executable_add_exception_objects,ppmfuzzer,\
+ vcl/workben/ppmfuzzer \
+))
+
+$(eval $(call gb_Executable_add_libs,ppmfuzzer,\
+ -lFuzzingEngine \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 9eaa3243e90b..2c46a97e12c5 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -117,6 +117,7 @@ $(eval $(call gb_Module_add_targets,vcl,\
Executable_pcdfuzzer \
Executable_dxffuzzer \
Executable_metfuzzer \
+ Executable_ppmfuzzer \
))
endif
diff --git a/vcl/workben/ppmfuzzer.cxx b/vcl/workben/ppmfuzzer.cxx
new file mode 100644
index 000000000000..152f08dd438d
--- /dev/null
+++ b/vcl/workben/ppmfuzzer.cxx
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <tools/stream.hxx>
+#include <vcl/FilterConfigItem.hxx>
+#include "commonfuzzer.hxx"
+
+extern "C" bool ipbGraphicImport(SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem);
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
+{
+ SvMemoryStream aStream(const_cast<uint8_t*>(data), size, StreamMode::READ);
+ Graphic aGraphic;
+ (void)ipbGraphicImport(aStream, aGraphic, nullptr);
+ return 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */