[Libreoffice-commits] core.git: lotuswordpro/source Makefile.in Repository.mk vcl/Executable_lwpfuzzer.mk vcl/Module_vcl.mk vcl/workben

Caolán McNamara caolanm at redhat.com
Thu Mar 2 14:14:22 UTC 2017


 Makefile.in                                             |    2 
 Repository.mk                                           |    1 
 lotuswordpro/source/filter/LotusWordProImportFilter.cxx |    5 -
 vcl/Executable_lwpfuzzer.mk                             |   48 ++++++++++++++++
 vcl/Module_vcl.mk                                       |    1 
 vcl/workben/fftester.cxx                                |    7 +-
 vcl/workben/lwpfuzzer.cxx                               |   23 +++++++
 7 files changed, 80 insertions(+), 7 deletions(-)

New commits:
commit 85abe70d7fe8e3ddf32780e816113aecca594a19
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Feb 27 09:35:54 2017 +0000

    add lwp fuzzer
    
    Change-Id: I72a2d8ce47059f9af65d89fbdcc09d96c40cb79b

diff --git a/Makefile.in b/Makefile.in
index 080ba46..6acef41 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -446,7 +446,7 @@ $(foreach ide,\
     eclipsecdt,\
 $(eval $(call gb_Top_GbuildToIdeIntegrationNS,$(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 Executable_giffuzzer Executable_xbmfuzzer Executable_xpmfuzzer Executable_pngfuzzer Executable_bmpfuzzer Executable_svmfuzzer Executable_pcdfuzzer Executable_dxffuzzer Executable_metfuzzer Executable_ppmfuzzer Executable_psdfuzzer Executable_epsfuzzer Executable_pctfuzzer Executable_pcxfuzzer Executable_rasfuzzer Executable_tgafuzzer Executable_tiffuzzer Executable_hwpfuzzer Executable_602fuzzer
+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 Executable_xbmfuzzer Executable_xpmfuzzer Executable_pngfuzzer Executable_bmpfuzzer Executable_svmfuzzer Executable_pcdfuzzer Executable_dxffuzzer Executable_metfuzzer Executable_ppmfuzzer Executable_psdfuzzer Executable_epsfuzzer Executable_pctfuzzer Executable_pcxfuzzer Executable_rasfuzzer Executable_tgafuzzer Executable_tiffuzzer Executable_hwpfuzzer Executable_602fuzzer Executable_lwpfuzzer
 
 endif # MAKE_RESTARTS
 
diff --git a/Repository.mk b/Repository.mk
index 50ff121..bf5f9a8 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -114,6 +114,7 @@ $(eval $(call gb_Helper_register_executables_for_install,OOO,brand, \
 	$(call gb_Helper_optional,FUZZERS,tiffuzzer) \
 	$(call gb_Helper_optional,FUZZERS,hwpfuzzer) \
 	$(call gb_Helper_optional,FUZZERS,602fuzzer) \
+	$(call gb_Helper_optional,FUZZERS,lwpfuzzer) \
 	$(if $(filter-out ANDROID IOS MACOSX WNT,$(OS)),oosplash) \
 	soffice_bin \
 	$(if $(filter DESKTOP,$(BUILD_TYPE)),unopkg_bin) \
diff --git a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx
index 1280da4..fb90b22 100644
--- a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx
+++ b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx
@@ -77,11 +77,10 @@ bool SAL_CALL LotusWordProImportFilter::importImpl( const Sequence< css::beans::
 
 }
 
-extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportLWP(const OUString &rURL)
+extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportLWP(SvStream &rStream)
 {
-    SvFileStream aFileStream(rURL, StreamMode::READ);
     uno::Reference< XDocumentHandler > xHandler;
-    return ( ReadWordproFile(aFileStream, xHandler) == 0 );
+    return ReadWordproFile(rStream, xHandler) == 0;
 }
 
 sal_Bool SAL_CALL LotusWordProImportFilter::filter( const Sequence< css::beans::PropertyValue >& aDescriptor )
diff --git a/vcl/Executable_lwpfuzzer.mk b/vcl/Executable_lwpfuzzer.mk
new file mode 100644
index 0000000..46c2867
--- /dev/null
+++ b/vcl/Executable_lwpfuzzer.mk
@@ -0,0 +1,48 @@
+# -*- 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,lwpfuzzer))
+
+$(eval $(call gb_Executable_use_api,lwpfuzzer,\
+    offapi \
+    udkapi \
+))
+
+$(eval $(call gb_Executable_use_externals,lwpfuzzer,\
+	$(fuzzer_externals) \
+))
+
+$(eval $(call gb_Executable_set_include,lwpfuzzer,\
+    $$(INCLUDE) \
+    -I$(SRCDIR)/vcl/inc \
+))
+
+$(eval $(call gb_Executable_use_libraries,lwpfuzzer,\
+	lwpft \
+	$(fuzzer_libraries) \
+))
+
+$(eval $(call gb_Executable_use_static_libraries,lwpfuzzer,\
+    findsofficepath \
+    ulingu \
+    fuzzer \
+))
+
+$(eval $(call gb_Executable_add_exception_objects,lwpfuzzer,\
+	vcl/workben/lwpfuzzer \
+))
+
+$(eval $(call gb_Executable_add_libs,lwpfuzzer,\
+	-lFuzzingEngine \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 109d41b..c229032 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -127,6 +127,7 @@ $(eval $(call gb_Module_add_targets,vcl,\
     Executable_tiffuzzer \
     Executable_hwpfuzzer \
     Executable_602fuzzer \
+    Executable_lwpfuzzer \
 ))
 endif
 
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index 56af89e..205a222 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -433,16 +433,17 @@ try_again:
             }
             else if (strcmp(argv[2], "lwp") == 0)
             {
-                static HFilterCall pfnImport(nullptr);
+                static FFilterCall pfnImport(nullptr);
                 if (!pfnImport)
                 {
                     osl::Module aLibrary;
                     aLibrary.loadRelative(&thisModule, "liblwpftlo.so", SAL_LOADMODULE_LAZY);
-                    pfnImport = reinterpret_cast<HFilterCall>(
+                    pfnImport = reinterpret_cast<FFilterCall>(
                         aLibrary.getFunctionSymbol("TestImportLWP"));
                     aLibrary.release();
                 }
-                ret = (int) (*pfnImport)(out);
+                SvFileStream aFileStream(out, StreamMode::READ);
+                ret = (int) (*pfnImport)(aFileStream);
             }
             else if (strcmp(argv[2], "ppt") == 0)
             {
diff --git a/vcl/workben/lwpfuzzer.cxx b/vcl/workben/lwpfuzzer.cxx
new file mode 100644
index 0000000..4fe06a2
--- /dev/null
+++ b/vcl/workben/lwpfuzzer.cxx
@@ -0,0 +1,23 @@
+/* -*- 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 TestImportLWP(SvStream &rStream);
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
+{
+    SvMemoryStream aStream(const_cast<uint8_t*>(data), size, StreamMode::READ);
+    (void)TestImportLWP(aStream);
+    return 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list