summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in2
-rw-r--r--Repository.mk1
-rw-r--r--vcl/Executable_giffuzzer.mk47
-rw-r--r--vcl/Module_vcl.mk1
-rw-r--r--vcl/workben/giffuzzer.cxx22
5 files changed, 72 insertions, 1 deletions
diff --git a/Makefile.in b/Makefile.in
index 43fd5e9353dc..a3b2a9f7062e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -424,7 +424,7 @@ $(foreach ide,\
eclipsecdt,\
$(eval $(call gb_Top_GbuildToIdeIntegration,$(ide))))
-fuzzers: Library_sal Library_salhelper Library_reg Library_store Library_unoidl codemaker Library_cppu Library_i18nlangtag Library_cppuhelper Library_comphelper StaticLibrary_ulingu StaticLibrary_jpeg StaticLibrary_findsofficepath Library_tl Rdb_services udkapi offapi Library_clew Library_gie Library_reflection Library_invocadapt Library_bootstrap Library_introspection Library_stocservices Library_xmlreader Library_gcc3_uno instsetoo_native more_fonts StaticLibrary_fuzzer Executable_wmffuzzer Executable_jpgfuzzer
+fuzzers: Library_sal Library_salhelper Library_reg Library_store Library_unoidl codemaker Library_cppu Library_i18nlangtag Library_cppuhelper Library_comphelper StaticLibrary_ulingu StaticLibrary_jpeg StaticLibrary_findsofficepath Library_tl Rdb_services udkapi offapi Library_clew Library_gie Library_reflection Library_invocadapt Library_bootstrap Library_introspection Library_stocservices Library_xmlreader Library_gcc3_uno instsetoo_native more_fonts StaticLibrary_fuzzer Executable_wmffuzzer Executable_jpgfuzzer Executable_giffuzzer
endif # MAKE_RESTARTS
diff --git a/Repository.mk b/Repository.mk
index 8305c97b3bbf..5d68ba001a14 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -95,6 +95,7 @@ $(eval $(call gb_Helper_register_executables_for_install,OOO,brand, \
$(call gb_Helper_optional,BREAKPAD,minidump_upload) \
$(call gb_Helper_optional,FUZZERS,wmffuzzer) \
$(call gb_Helper_optional,FUZZERS,jpgfuzzer) \
+ $(call gb_Helper_optional,FUZZERS,giffuzzer) \
$(if $(filter-out ANDROID IOS MACOSX WNT,$(OS)),oosplash) \
soffice_bin \
$(if $(filter DESKTOP,$(BUILD_TYPE)),unopkg_bin) \
diff --git a/vcl/Executable_giffuzzer.mk b/vcl/Executable_giffuzzer.mk
new file mode 100644
index 000000000000..132b445aab2b
--- /dev/null
+++ b/vcl/Executable_giffuzzer.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,giffuzzer))
+
+$(eval $(call gb_Executable_use_api,giffuzzer,\
+ offapi \
+ udkapi \
+))
+
+$(eval $(call gb_Executable_use_externals,giffuzzer,\
+ $(fuzzer_externals) \
+))
+
+$(eval $(call gb_Executable_set_include,giffuzzer,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/vcl/inc \
+))
+
+$(eval $(call gb_Executable_use_libraries,giffuzzer,\
+ $(fuzzer_libraries) \
+))
+
+$(eval $(call gb_Executable_use_static_libraries,giffuzzer,\
+ findsofficepath \
+ ulingu \
+ fuzzer \
+))
+
+$(eval $(call gb_Executable_add_exception_objects,giffuzzer,\
+ vcl/workben/giffuzzer \
+))
+
+$(eval $(call gb_Executable_add_libs,giffuzzer,\
+ -lFuzzingEngine \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index a9b91eb12493..44b51318a6d3 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -108,6 +108,7 @@ $(eval $(call gb_Module_add_targets,vcl,\
StaticLibrary_fuzzer \
Executable_wmffuzzer \
Executable_jpgfuzzer \
+ Executable_giffuzzer \
))
endif
diff --git a/vcl/workben/giffuzzer.cxx b/vcl/workben/giffuzzer.cxx
new file mode 100644
index 000000000000..20167da9002e
--- /dev/null
+++ b/vcl/workben/giffuzzer.cxx
@@ -0,0 +1,22 @@
+/* -*- 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 <../source/filter/igif/gifread.hxx>
+#include "commonfuzzer.hxx"
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
+{
+ SvMemoryStream aStream(const_cast<uint8_t*>(data), size, StreamMode::READ);
+ Graphic aGraphic;
+ (void)ImportGIF(aStream, aGraphic);
+ return 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */