1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
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" bool TestImportCalcRTF(SvStream
& rStream
);
18 extern "C" int LLVMFuzzerInitialize(int* argc
, char*** argv
)
23 CommonInitialize(argc
, argv
);
25 // initialise unconfigured UCB:
26 css::uno::Reference
<css::ucb::XUniversalContentBroker
> xUcb(
27 comphelper::getProcessServiceFactory()->createInstance(
28 "com.sun.star.ucb.UniversalContentBroker"),
29 css::uno::UNO_QUERY_THROW
);
30 css::uno::Sequence
<css::uno::Any
> aArgs(1);
31 aArgs
[0] <<= OUString("NoConfig");
32 css::uno::Reference
<css::ucb::XContentProvider
> xFileProvider(
33 comphelper::getProcessServiceFactory()->createInstanceWithArguments(
34 "com.sun.star.ucb.FileContentProvider", aArgs
),
35 css::uno::UNO_QUERY_THROW
);
36 xUcb
->registerContentProvider(xFileProvider
, "file", true);
44 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data
, size_t size
)
46 SvMemoryStream
aStream(const_cast<uint8_t*>(data
), size
, StreamMode::READ
);
47 (void)TestImportCalcRTF(aStream
);
48 //fontconfigs alloc mechanism is too complicated for lsan/valgrind so
49 //force the fontconfig options to be released now, they are demand loaded
50 //so will be recreated if necessary
51 SvpSalGraphics::getPlatformGlyphCache().ClearFontOptions();
55 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */