bump product version to 6.4.0.3
[LibreOffice.git] / vcl / workben / wksfuzzer.cxx
blobe4eae020159dd28671a489b9ff2225d75e40c5be
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <tools/stream.hxx>
11 #include <vcl/FilterConfigItem.hxx>
12 #include <com/sun/star/ucb/XContentProvider.hpp>
13 #include <com/sun/star/ucb/XUniversalContentBroker.hpp>
14 #include "commonfuzzer.hxx"
16 extern "C" void* ScCreateDialogFactory() { return nullptr; }
18 extern "C" bool TestImportWKS(SvStream& rStream);
20 extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv)
22 if (__lsan_disable)
23 __lsan_disable();
25 CommonInitialize(argc, argv);
27 // initialise unconfigured UCB:
28 css::uno::Reference<css::ucb::XUniversalContentBroker> xUcb(
29 comphelper::getProcessServiceFactory()->createInstance(
30 "com.sun.star.ucb.UniversalContentBroker"),
31 css::uno::UNO_QUERY_THROW);
32 css::uno::Sequence<css::uno::Any> aArgs(1);
33 aArgs[0] <<= OUString("NoConfig");
34 css::uno::Reference<css::ucb::XContentProvider> xFileProvider(
35 comphelper::getProcessServiceFactory()->createInstanceWithArguments(
36 "com.sun.star.ucb.FileContentProvider", aArgs),
37 css::uno::UNO_QUERY_THROW);
38 xUcb->registerContentProvider(xFileProvider, "file", true);
40 if (__lsan_enable)
41 __lsan_enable();
43 return 0;
46 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
48 SvMemoryStream aStream(const_cast<uint8_t*>(data), size, StreamMode::READ);
49 (void)TestImportWKS(aStream);
50 // fontconfigs alloc mechanism is too complicated for lsan/valgrind so
51 // force the fontconfig options to be released now, they are demand loaded
52 // so will be recreated if necessary
53 SvpSalGraphics::getPlatformGlyphCache().ClearFontOptions();
54 return 0;
57 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */