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 /vcl | |
parent | 23672df737258391bd9533e61733c6cc70b9a5eb (diff) |
add lwp fuzzer
Change-Id: I72a2d8ce47059f9af65d89fbdcc09d96c40cb79b
Diffstat (limited to 'vcl')
-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 |
4 files changed, 76 insertions, 3 deletions
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: */ |