vcl/Executable_fftester.mk | 6 +++++- vcl/inc/unx/glyphcache.hxx | 2 ++ vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 5 +++++ vcl/unx/generic/glyphs/glyphcache.cxx | 10 ++++++++++ vcl/workben/commonfuzzer.hxx | 2 ++ vcl/workben/fftester.cxx | 15 ++++++++++----- vcl/workben/pptfuzzer.cxx | 4 ++++ 7 files changed, 38 insertions(+), 6 deletions(-)
New commits: commit 38e729223a4cdca87ef1baccfc533156c80b5dab Author: Caolán McNamara <[email protected]> Date: Fri Mar 24 10:05:49 2017 +0000 ofz: explicitly release fontconfig options on every iteration fontconfigs alloc mechanism is too complicated for lsan/valgrind so force the fontconfig options to be released at the end of every iteration, they are demand loaded so will be recreated if necessary on next use Change-Id: I061117b1fb8136298593a165847f78eabe008f0f diff --git a/vcl/Executable_fftester.mk b/vcl/Executable_fftester.mk index 0eaa4e39c3c2..14fa5965193d 100644 --- a/vcl/Executable_fftester.mk +++ b/vcl/Executable_fftester.mk @@ -15,7 +15,11 @@ $(eval $(call gb_Executable_use_api,fftester,\ udkapi \ )) -$(eval $(call gb_Executable_use_external,fftester,boost_headers)) +$(eval $(call gb_Executable_use_externals,fftester,\ + boost_headers \ + freetype_headers \ + harfbuzz \ +)) $(eval $(call gb_Executable_set_include,fftester,\ $$(INCLUDE) \ diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx index 4c0ce0d2695a..8d66fbb23eac 100644 --- a/vcl/inc/unx/glyphcache.hxx +++ b/vcl/inc/unx/glyphcache.hxx @@ -67,6 +67,7 @@ public: void UncacheFont( FreetypeFont& ); void ClearFontCache(); void InvalidateAllGlyphs(); + void ClearFontOptions(); private: friend class FreetypeFont; @@ -124,6 +125,7 @@ public: FT_Face GetFtFace() const; int GetLoadFlags() const { return (mnLoadFlags & ~FT_LOAD_IGNORE_TRANSFORM); } const FontConfigFontOptions* GetFontOptions() const; + void ClearFontOptions(); bool NeedsArtificialBold() const { return mbArtBold; } bool NeedsArtificialItalic() const { return mbArtItalic; } diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx index 0737d2bdf3d1..c24dd5f3e050 100644 --- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx +++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx @@ -476,6 +476,11 @@ const FontConfigFontOptions* FreetypeFont::GetFontOptions() const return mxFontOptions.get(); } +void FreetypeFont::ClearFontOptions() +{ + mxFontOptions.reset(); +} + const OString& FreetypeFont::GetFontFileName() const { return mpFontInfo->GetFontFileName(); diff --git a/vcl/unx/generic/glyphs/glyphcache.cxx b/vcl/unx/generic/glyphs/glyphcache.cxx index 1a49c524415f..b72a0a0cd4a1 100644 --- a/vcl/unx/generic/glyphs/glyphcache.cxx +++ b/vcl/unx/generic/glyphs/glyphcache.cxx @@ -64,6 +64,16 @@ void GlyphCache::InvalidateAllGlyphs() mpCurrentGCFont = nullptr; } +void GlyphCache::ClearFontOptions() +{ + for( FontList::iterator it = maFontList.begin(), end = maFontList.end(); it != end; ++it ) + { + FreetypeFont* pFreetypeFont = it->second; + // free demand-loaded FontConfig related data + pFreetypeFont->ClearFontOptions(); + } +} + inline size_t GlyphCache::IFSD_Hash::operator()( const FontSelectPattern& rFontSelData ) const { diff --git a/vcl/workben/commonfuzzer.hxx b/vcl/workben/commonfuzzer.hxx index f88d835cf59d..59c0ae265f53 100644 --- a/vcl/workben/commonfuzzer.hxx +++ b/vcl/workben/commonfuzzer.hxx @@ -24,7 +24,9 @@ #include <vcl/wmf.hxx> #include <unistd.h> #include <stdlib.h> +#include "headless/svpgdi.hxx" #include "unx/fontmanager.hxx" +#include "unx/glyphcache.hxx" using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx index 3611a9dd8275..d6d74f7e48aa 100644 --- a/vcl/workben/fftester.cxx +++ b/vcl/workben/fftester.cxx @@ -52,6 +52,8 @@ #include <osl/file.hxx> #include <unistd.h> #include <signal.h> +#include "headless/svpgdi.hxx" +#include "unx/glyphcache.hxx" #include <../source/filter/igif/gifread.hxx> #include <../source/filter/ixbm/xbmread.hxx> @@ -88,6 +90,12 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) return -1; } + setenv("SAL_USE_VCLPLUGIN", "svp", 1); + setenv("JPEGMEM", "768M", 1); + setenv("SAL_WMF_COMPLEXCLIP_VIA_REGION", "1", 1); + setenv("SAL_DISABLE_PRINTERLIST", "1", 1); + setenv("SAL_NO_FONT_LOOKUP", "1", 1); + OUString in(argv[1], strlen(argv[1]), RTL_TEXTENCODING_UTF8); OUString out; osl::File::getFileURLFromSystemPath(in, out); @@ -102,11 +110,6 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) utl::ConfigManager::EnableAvoidConfig(); InitVCL(); - setenv("JPEGMEM", "768M", 1); - setenv("SAL_WMF_COMPLEXCLIP_VIA_REGION", "1", 1); - setenv("SAL_DISABLE_PRINTERLIST", "1", 1); - setenv("SAL_NO_FONT_LOOKUP", "1", 1); - try_again: { @@ -444,6 +447,8 @@ try_again: } /* If AFL_PERSISTENT not set or PERSIST_MAX exceeded, exit normally. */ + + SvpSalGraphics::getPlatformGlyphCache().ClearFontOptions(); } catch (...) { diff --git a/vcl/workben/pptfuzzer.cxx b/vcl/workben/pptfuzzer.cxx index 45c1571171f0..6b22bba50bd8 100644 --- a/vcl/workben/pptfuzzer.cxx +++ b/vcl/workben/pptfuzzer.cxx @@ -32,6 +32,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { SvMemoryStream aStream(const_cast<uint8_t*>(data), size, StreamMode::READ); (void)TestImportPPT(aStream); + //fontconfigs alloc mechanism is too complicated for lsan/valgrind so + //force the fontconfig options to be released now, they are demand loaded + //so will be recreated if necessary + SvpSalGraphics::getPlatformGlyphCache().ClearFontOptions(); return 0; }
_______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
