diff options
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | Repository.mk | 1 | ||||
-rw-r--r-- | sw/Library_sw.mk | 12 | ||||
-rw-r--r-- | sw/inc/shellio.hxx | 4 | ||||
-rw-r--r-- | sw/source/filter/rtf/swparrtf.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/app/apphdl.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/inc/uivwimp.hxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uiview/uivwimp.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view0.cxx | 4 | ||||
-rw-r--r-- | vcl/CustomTarget_nativecode.mk | 2 | ||||
-rw-r--r-- | vcl/Executable_rtffuzzer.mk | 47 | ||||
-rw-r--r-- | vcl/Module_vcl.mk | 3 | ||||
-rw-r--r-- | vcl/commonfuzzer.mk | 5 | ||||
-rw-r--r-- | vcl/workben/fftester.cxx | 8 | ||||
-rw-r--r-- | vcl/workben/rtffuzzer.cxx | 33 |
15 files changed, 106 insertions, 31 deletions
diff --git a/Makefile.in b/Makefile.in index 87b4e97117f2..a505d37d9a4c 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_findsofficepath Library_tl Library_basegfx Library_canvastools Library_cppcanvas Library_dbtools Library_deploymentmisc Library_deploymentmisc Library_editeng Library_fwe Library_fwi Library_i18nutil Library_localebe1 Library_sax Library_sofficeapp Library_ucbhelper Library_opencl Rdb_services udkapi offapi Library_clew Library_gie Library_icg 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 Executable_olefuzzer AllLangResTarget_sd Executable_pptfuzzer +fuzzers: Library_sal Library_salhelper Library_reg Library_store Library_unoidl codemaker Library_cppu Library_i18nlangtag Library_cppuhelper Library_comphelper StaticLibrary_ulingu StaticLibrary_findsofficepath Library_tl Library_basegfx Library_canvastools Library_cppcanvas Library_dbtools Library_deploymentmisc Library_deploymentmisc Library_editeng Library_fwe Library_fwi Library_i18nutil Library_localebe1 Library_sax Library_sofficeapp Library_ucbhelper Library_opencl Rdb_services udkapi offapi Library_clew Library_gie Library_icg 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 Executable_olefuzzer AllLangResTarget_sd Executable_pptfuzzer Executable_rtffuzzer endif # MAKE_RESTARTS diff --git a/Repository.mk b/Repository.mk index 0c8dc9aeae39..e66677b87dc1 100644 --- a/Repository.mk +++ b/Repository.mk @@ -117,6 +117,7 @@ $(eval $(call gb_Helper_register_executables_for_install,OOO,brand, \ $(call gb_Helper_optional,FUZZERS,lwpfuzzer) \ $(call gb_Helper_optional,FUZZERS,olefuzzer) \ $(call gb_Helper_optional,FUZZERS,pptfuzzer) \ + $(call gb_Helper_optional,FUZZERS,rtffuzzer) \ $(if $(filter-out ANDROID IOS MACOSX WNT,$(OS)),oosplash) \ soffice_bin \ $(if $(filter DESKTOP,$(BUILD_TYPE)),unopkg_bin) \ diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index 811c8c629ef6..847d061af188 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -571,6 +571,11 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/uibase/app/swmodul1 \ sw/source/uibase/app/swmodule \ sw/source/uibase/app/swwait \ + sw/source/uibase/dbui/dbmgr \ + sw/source/uibase/dbui/dbui \ + sw/source/uibase/dbui/maildispatcher \ + sw/source/uibase/dbui/mailmergehelper \ + sw/source/uibase/dbui/mmconfigitem \ sw/source/uibase/cctrl/actctrl \ sw/source/uibase/chrdlg/ccoll \ sw/source/uibase/config/StoredChapterNumbering \ @@ -722,6 +727,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/uibase/uno/unodispatch \ sw/source/uibase/uno/unodoc \ sw/source/uibase/uno/unofreg \ + sw/source/uibase/uno/unomailmerge \ sw/source/uibase/uno/unomod \ sw/source/uibase/uno/unomodule \ sw/source/uibase/uno/unotxdoc \ @@ -768,14 +774,8 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ ifneq (,$(filter DBCONNECTIVITY,$(BUILD_TYPE))) $(eval $(call gb_Library_add_exception_objects,sw,\ - sw/source/uibase/dbui/dbmgr \ sw/source/uibase/dbui/dbtree \ - sw/source/uibase/dbui/dbui \ - sw/source/uibase/dbui/maildispatcher \ - sw/source/uibase/dbui/mailmergehelper \ sw/source/uibase/dbui/mailmergetoolbarcontrols \ - sw/source/uibase/dbui/mmconfigitem \ - sw/source/uibase/uno/unomailmerge \ )) endif diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx index 3a05a064c199..283422710fc2 100644 --- a/sw/inc/shellio.hxx +++ b/sw/inc/shellio.hxx @@ -178,13 +178,13 @@ protected: #define SW_STORAGE_READER 2 extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportDOC(const OUString &rUrl, const OUString &rFltName); -extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportRTF(const OUString &rUrl); +extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportRTF(SvStream &rStream); class SW_DLLPUBLIC Reader { friend class SwReader; friend bool TestImportDOC(const OUString &rUrl, const OUString &rFltName); - friend bool TestImportRTF(const OUString &rUrl); + friend bool TestImportRTF(SvStream &rStream); rtl::Reference<SwDoc> mxTemplate; OUString aTemplateNm; diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index 1b6955acd873..cdcff0f3d0ab 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -158,10 +158,8 @@ extern "C" SAL_DLLPUBLIC_EXPORT Reader* SAL_CALL ImportRTF() return new SwRTFReader; } -extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportRTF(const OUString& rURL) +extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportRTF(SvStream &rStream) { - SvFileStream aFileStream(rURL, StreamMode::READ); - SwGlobals::ensure(); SfxObjectShellLock xDocSh(new SwDocShell(SfxObjectCreateMode::INTERNAL)); @@ -177,7 +175,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportRTF(const OUString& rURL uno::Reference<document::XFilter> xFilter(xInterface, uno::UNO_QUERY_THROW); uno::Sequence<beans::PropertyValue> aDescriptor(1); aDescriptor[0].Name = "InputStream"; - uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(aFileStream)); + uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(rStream)); aDescriptor[0].Value <<= xStream; bool bRet = true; try diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index ef5ac4a90984..6babf28f7df5 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -241,8 +241,6 @@ void SwModule::StateOther(SfxItemSet &rSet) // start field dialog void NewXForms( SfxRequest& rReq ); // implementation: below -#if HAVE_FEATURE_DBCONNECTIVITY - std::shared_ptr<SwMailMergeConfigItem> SwView::EnsureMailMergeConfigItem(const SfxItemSet* pArgs, sal_uInt16 nWizardRestartPage) { // create if it does not exist yet @@ -305,6 +303,8 @@ std::shared_ptr<SwMailMergeConfigItem> SwView::EnsureMailMergeConfigItem(const S return xMMConfig; } +#if HAVE_FEATURE_DBCONNECTIVITY + namespace { diff --git a/sw/source/uibase/inc/uivwimp.hxx b/sw/source/uibase/inc/uivwimp.hxx index c47056c6eb9a..68c3707be574 100644 --- a/sw/source/uibase/inc/uivwimp.hxx +++ b/sw/source/uibase/inc/uivwimp.hxx @@ -101,11 +101,9 @@ class SwView_Impl mxClipEvtLstnr; ShellMode eShellMode; -#if HAVE_FEATURE_DBCONNECTIVITY std::shared_ptr<SwMailMergeConfigItem> xConfigItem; sal_uInt16 nMailMergeRestartPage; -#endif sfx2::DocumentInserter* m_pDocInserter; SfxRequest* m_pRequest; @@ -137,14 +135,12 @@ public: void AddTransferable(SwTransferable& rTransferable); -#if HAVE_FEATURE_DBCONNECTIVITY void SetMailMergeConfigItem(std::shared_ptr<SwMailMergeConfigItem>& rItem, sal_uInt16 nRestart) { xConfigItem = rItem; nMailMergeRestartPage = nRestart; } std::shared_ptr<SwMailMergeConfigItem> GetMailMergeConfigItem() {return xConfigItem;} -#endif //#i33307# restore editing position void SetRestorePosition(const Point& rCursorPos, bool bSelectObj) diff --git a/sw/source/uibase/uiview/uivwimp.cxx b/sw/source/uibase/uiview/uivwimp.cxx index 98a69adce690..b1ff6e0794c6 100644 --- a/sw/source/uibase/uiview/uivwimp.cxx +++ b/sw/source/uibase/uiview/uivwimp.cxx @@ -56,9 +56,7 @@ SwView_Impl::SwView_Impl(SwView* pShell) : mxXTextView() , pView(pShell) , eShellMode(ShellMode::Text) -#if HAVE_FEATURE_DBCONNECTIVITY , nMailMergeRestartPage(0) -#endif , m_pDocInserter(nullptr) , m_pRequest(nullptr) , m_nParam(0) diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index 6c14a72f9c6c..791af4811fb2 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -131,8 +131,6 @@ void SwView::ApplyAccessiblityOptions(SvtAccessibilityOptions& rAccessibilityOpt } -#if HAVE_FEATURE_DBCONNECTIVITY - void SwView::SetMailMergeConfigItem(std::shared_ptr<SwMailMergeConfigItem>& rConfigItem, sal_uInt16 nRestart) { @@ -145,8 +143,6 @@ std::shared_ptr<SwMailMergeConfigItem> SwView::GetMailMergeConfigItem() const return m_pViewImpl->GetMailMergeConfigItem(); } -#endif - static bool lcl_IsViewMarks( const SwViewOption& rVOpt ) { return rVOpt.IsHardBlank() && diff --git a/vcl/CustomTarget_nativecode.mk b/vcl/CustomTarget_nativecode.mk index f424a2170dca..f092541a5f66 100644 --- a/vcl/CustomTarget_nativecode.mk +++ b/vcl/CustomTarget_nativecode.mk @@ -13,6 +13,6 @@ fuzzer_PYTHONCOMMAND := $(call gb_ExternalExecutable_get_command,python) fuzzer_Native_cxx=$(call gb_CustomTarget_get_workdir,vcl/workben)/native-code.cxx $(fuzzer_Native_cxx): $(SRCDIR)/solenv/bin/native-code.py | $(call gb_CustomTarget_get_workdir,vcl/workben)/.dir - $(call gb_Helper_abbreviate_dirs, $(fuzzer_PYTHONCOMMAND) $(SRCDIR)/solenv/bin/native-code.py -g core -g draw) > $@ + $(call gb_Helper_abbreviate_dirs, $(fuzzer_PYTHONCOMMAND) $(SRCDIR)/solenv/bin/native-code.py -g core -g draw -g writer) > $@ # vim: set noet sw=4 ts=4: diff --git a/vcl/Executable_rtffuzzer.mk b/vcl/Executable_rtffuzzer.mk new file mode 100644 index 000000000000..38b64a179f27 --- /dev/null +++ b/vcl/Executable_rtffuzzer.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,rtffuzzer)) + +$(eval $(call gb_Executable_use_api,rtffuzzer,\ + offapi \ + udkapi \ +)) + +$(eval $(call gb_Executable_use_externals,rtffuzzer,\ + $(fuzzer_externals) \ +)) + +$(eval $(call gb_Executable_set_include,rtffuzzer,\ + $$(INCLUDE) \ + -I$(SRCDIR)/vcl/inc \ +)) + +$(eval $(call gb_Executable_use_libraries,rtffuzzer,\ + $(fuzzer_libraries) \ +)) + +$(eval $(call gb_Executable_use_static_libraries,rtffuzzer,\ + findsofficepath \ + ulingu \ + fuzzer \ +)) + +$(eval $(call gb_Executable_add_exception_objects,rtffuzzer,\ + vcl/workben/rtffuzzer \ +)) + +$(eval $(call gb_Executable_add_libs,rtffuzzer,\ + -lFuzzingEngine \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index 52f93e060551..c70c07a0d2c7 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -129,7 +129,8 @@ $(eval $(call gb_Module_add_targets,vcl,\ Executable_602fuzzer \ Executable_lwpfuzzer \ Executable_olefuzzer \ - Executable_pptfuzzer \ + Executable_pptfuzzer \ + Executable_rtffuzzer \ )) endif diff --git a/vcl/commonfuzzer.mk b/vcl/commonfuzzer.mk index 8892b86c015a..fa1320913563 100644 --- a/vcl/commonfuzzer.mk +++ b/vcl/commonfuzzer.mk @@ -38,6 +38,11 @@ fuzzer_externals = \ zlib \ fuzzer_libraries = \ + msword \ + sw \ + swd \ + writerfilter \ + textfd \ sdfilt \ sd \ sdd \ diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx index 1dc51e2bdafd..3b7a1619d45e 100644 --- a/vcl/workben/fftester.cxx +++ b/vcl/workben/fftester.cxx @@ -67,7 +67,6 @@ extern "C" { static void SAL_CALL thisModule() {} } #endif typedef bool (*WFilterCall)(const OUString &rUrl, const OUString &rFlt); -typedef bool (*HFilterCall)(const OUString &rUrl); typedef bool (*FFilterCall)(SvStream &rStream); /* This constant specifies the number of inputs to process before restarting. @@ -349,16 +348,17 @@ try_again: } else if (strcmp(argv[2], "rtf") == 0) { - static HFilterCall pfnImport(nullptr); + static FFilterCall pfnImport(nullptr); if (!pfnImport) { osl::Module aLibrary; aLibrary.loadRelative(&thisModule, "libmswordlo.so", SAL_LOADMODULE_LAZY); - pfnImport = reinterpret_cast<HFilterCall>( + pfnImport = reinterpret_cast<FFilterCall>( aLibrary.getFunctionSymbol("TestImportRTF")); aLibrary.release(); } - ret = (int) (*pfnImport)(out); + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream); } else if ( (strcmp(argv[2], "xls") == 0) || (strcmp(argv[2], "wb2") == 0) ) diff --git a/vcl/workben/rtffuzzer.cxx b/vcl/workben/rtffuzzer.cxx new file mode 100644 index 000000000000..88f9b48c8c80 --- /dev/null +++ b/vcl/workben/rtffuzzer.cxx @@ -0,0 +1,33 @@ +/* -*- 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 TestImportRTF(SvStream &rStream); + +extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) +{ + TypicalFuzzerInitialize(argc, argv); + return 0; +} + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + SvMemoryStream aStream(const_cast<uint8_t*>(data), size, StreamMode::READ); + (void)TestImportRTF(aStream); + //fontconfigs alloc mechanism is too complicated for lsan/valgrind so + //force the fontconfig options to be released now, they are demand loaded + //so will be recreated if necessary + SvpSalGraphics::getPlatformGlyphCache().ClearFontOptions(); + return 0; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |