From e7e857a078de741d47ed31307b5f92ab7832ec20 Mon Sep 17 00:00:00 2001 From: Masatoshi Kimura Date: Tue, 28 Feb 2012 17:04:05 +0100 Subject: [PATCH] Bug 730550 - Make sure the t2embed library is available before using. r=jdaggett --HG-- extra : rebase_source : f5fd56246a71795ad872f4db10c58c9f28fbaac2 --- gfx/thebes/gfxGDIFontList.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gfx/thebes/gfxGDIFontList.cpp b/gfx/thebes/gfxGDIFontList.cpp index d8a99ae85d1..1919f089813 100644 --- a/gfx/thebes/gfxGDIFontList.cpp +++ b/gfx/thebes/gfxGDIFontList.cpp @@ -103,6 +103,8 @@ BuildKeyNameFromFontName(nsAString &aName) // Implementation of gfxPlatformFontList for Win32 GDI, // using GDI font enumeration APIs to get the list of fonts +static HMODULE fontlib; + class WinUserFontData : public gfxUserFontData { public: WinUserFontData(HANDLE aFontRef, bool aIsEmbedded) @@ -563,6 +565,12 @@ GDIFontFamily::FindStyleVariations() gfxGDIFontList::gfxGDIFontList() { mFontSubstitutes.Init(50); + + // Make sure the t2embed library is available because it may be + // disabled to work around security vulnerabilities. + if (!fontlib) { + fontlib = LoadLibraryW(L"t2embed.dll"); + } } static void @@ -852,6 +860,10 @@ gfxGDIFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry, }; FontDataDeleter autoDelete(aFontData); + // if the t2embed library isn't available, bail + if (!fontlib) + return nsnull; + bool hasVertical; bool isCFF = gfxFontUtils::IsCffFont(aFontData, hasVertical);