office-gobmx/vcl/workben/wksfuzzer.cxx
Caolán McNamara f73980ed15 Related: tdf#132536 drop FreetypeManager FreetypeFont caching
the FreetypeFont only makes sense in the context of the FreetypeFontInstance it
belongs to so remove the faux "garbage collection" and just have FreetypeFontInstance
own the FreetypeFont and keep it simple.

Setting a value low enough to make the garbage collection kick in just crasheed
libreoffice by pulling FreetypeFont out from under living FreetypeFontInstance
seeing as the Cache/Uncache was by the FreeTypeTextRenderImpl not the
FreetypeFontInstance which had HarfBuff faces which continued to point to the
removed FreetypeFont

There is still a cache at the LogicalFontInstance level, so this aligns the
libfreetype platforms with windows, mac etc.

Change-Id: Iac669fae8dc1df81a5bc10d2943d84a2ff623180
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94546
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-05-22 13:28:50 +02:00

53 lines
1.7 KiB
C++

/* -*- 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 <com/sun/star/ucb/XContentProvider.hpp>
#include <com/sun/star/ucb/XUniversalContentBroker.hpp>
#include "commonfuzzer.hxx"
extern "C" void* ScCreateDialogFactory() { return nullptr; }
extern "C" bool TestImportWKS(SvStream& rStream);
extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv)
{
if (__lsan_disable)
__lsan_disable();
CommonInitialize(argc, argv);
// initialise unconfigured UCB:
css::uno::Reference<css::ucb::XUniversalContentBroker> xUcb(
comphelper::getProcessServiceFactory()->createInstance(
"com.sun.star.ucb.UniversalContentBroker"),
css::uno::UNO_QUERY_THROW);
css::uno::Sequence<css::uno::Any> aArgs(1);
aArgs[0] <<= OUString("NoConfig");
css::uno::Reference<css::ucb::XContentProvider> xFileProvider(
comphelper::getProcessServiceFactory()->createInstanceWithArguments(
"com.sun.star.ucb.FileContentProvider", aArgs),
css::uno::UNO_QUERY_THROW);
xUcb->registerContentProvider(xFileProvider, "file", true);
if (__lsan_enable)
__lsan_enable();
return 0;
}
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
SvMemoryStream aStream(const_cast<uint8_t*>(data), size, StreamMode::READ);
(void)TestImportWKS(aStream);
return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */