diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-12-02 17:24:30 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-12-05 12:07:41 +0000 |
commit | ec65b855546eb8a6d139ade7fd147eb7f322de66 (patch) | |
tree | d275024ec47b5249178912829a607a88381c9d0a /vcl | |
parent | e96e5512a94bd6fd354576ed033755998ec92bd7 (diff) |
stash oss-fuzz demo target in our tree
Change-Id: If95e59ffd76a3c3b9dbcdbcbee6a9233f6fd9bac
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/Executable_wmftester.mk | 44 | ||||
-rw-r--r-- | vcl/workben/wmftester.cxx | 53 |
2 files changed, 97 insertions, 0 deletions
diff --git a/vcl/Executable_wmftester.mk b/vcl/Executable_wmftester.mk new file mode 100644 index 000000000000..b8872543d54a --- /dev/null +++ b/vcl/Executable_wmftester.mk @@ -0,0 +1,44 @@ +# -*- 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/. +# + +$(eval $(call gb_Executable_Executable,wmftester)) + +$(eval $(call gb_Executable_use_api,wmftester,\ + offapi \ + udkapi \ +)) + +$(eval $(call gb_Executable_use_external,wmftester,boost_headers)) + +$(eval $(call gb_Executable_set_include,wmftester,\ + $$(INCLUDE) \ + -I$(SRCDIR)/vcl/inc \ +)) + +$(eval $(call gb_Executable_use_libraries,wmftester,\ + tl \ + sal \ + utl \ + vcl \ + cppu \ + cppuhelper \ + comphelper \ +)) + +$(eval $(call gb_Executable_add_exception_objects,wmftester,\ + vcl/workben/wmftester \ +)) + + +$(eval $(call gb_Executable_add_libs,wmftester,\ + -lfuzzer \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/vcl/workben/wmftester.cxx b/vcl/workben/wmftester.cxx new file mode 100644 index 000000000000..9514cae7841e --- /dev/null +++ b/vcl/workben/wmftester.cxx @@ -0,0 +1,53 @@ +/* -*- 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 <sal/main.h> +#include <tools/extendapplicationenvironment.hxx> + +#include <cppuhelper/bootstrap.hxx> +#include <comphelper/processfactory.hxx> + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <unotools/configmgr.hxx> +#include <vcl/svapp.hxx> +#include <vcl/wmf.hxx> +#include <unistd.h> +#include <signal.h> + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace cppu; + +int LLVMFuzzerInitialize(int *argc, char ***argv) +{ + osl_setCommandArgs(*argc, *argv); + + tools::extendApplicationEnvironment(); + + Reference< XComponentContext > xContext = defaultBootstrap_InitialComponentContext(); + Reference< XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), UNO_QUERY ); + if( !xServiceManager.is() ) + Application::Abort( "Failed to bootstrap" ); + comphelper::setProcessServiceFactory( xServiceManager ); + utl::ConfigManager::EnableAvoidConfig(); + InitVCL(); + + return 0; +} + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + SvMemoryStream aStream(const_cast<uint8_t*>(data), size, StreamMode::READ); + GDIMetaFile aGDIMetaFile; + (void)ReadWindowMetafile(aStream, aGDIMetaFile); + return 0; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |