diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-02-27 09:35:54 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-03-02 14:13:54 +0000 |
commit | 85abe70d7fe8e3ddf32780e816113aecca594a19 (patch) | |
tree | f3e2b31677c3d2fe25b067c75e588b4c3a44f777 | |
parent | 23672df737258391bd9533e61733c6cc70b9a5eb (diff) |
add lwp fuzzer
Change-Id: I72a2d8ce47059f9af65d89fbdcc09d96c40cb79b
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | Repository.mk | 1 | ||||
-rw-r--r-- | lotuswordpro/source/filter/LotusWordProImportFilter.cxx | 5 | ||||
-rw-r--r-- | vcl/Executable_lwpfuzzer.mk | 48 | ||||
-rw-r--r-- | vcl/Module_vcl.mk | 1 | ||||
-rw-r--r-- | vcl/workben/fftester.cxx | 7 | ||||
-rw-r--r-- | vcl/workben/lwpfuzzer.cxx | 23 |
7 files changed, 80 insertions, 7 deletions
diff --git a/Makefile.in b/Makefile.in index 080ba469a5e9..6acef411aa1e 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 50ff121b3114..bf5f9a8698a4 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 1280da490ab1..fb90b22f6085 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 000000000000..46c2867502de --- /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 109d41b29787..c2290325b01e 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 56af89e0f820..205a222ca0b1 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 000000000000..4fe06a2b17af --- /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: */ |