[Libreoffice-commits] core.git: vcl/Executable_wmftester.mk vcl/workben

Caolán McNamara caolanm at redhat.com
Mon Dec 5 12:09:13 UTC 2016


 vcl/Executable_wmftester.mk |   44 ++++++++++++++++++++++++++++++++++++
 vcl/workben/wmftester.cxx   |   53 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+)

New commits:
commit ec65b855546eb8a6d139ade7fd147eb7f322de66
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Dec 2 17:24:30 2016 +0000

    stash oss-fuzz demo target in our tree
    
    Change-Id: If95e59ffd76a3c3b9dbcdbcbee6a9233f6fd9bac

diff --git a/vcl/Executable_wmftester.mk b/vcl/Executable_wmftester.mk
new file mode 100644
index 0000000..b887254
--- /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 0000000..9514cae
--- /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: */


More information about the Libreoffice-commits mailing list