[poppler] splash/SplashFTFont.cc splash/SplashFTFont.h

Albert Astals Cid aacid at kemper.freedesktop.org
Fri Jun 22 21:56:20 UTC 2018


 splash/SplashFTFont.cc |    7 +++++--
 splash/SplashFTFont.h  |    3 ++-
 2 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit af4d5f31705dcfd65319da430f87744b5c1f3616
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Jun 22 23:55:09 2018 +0200

    SplashFTFont::makeGlyph: Bail out if constructor returned early
    
    fixes oss-fuzz/8811

diff --git a/splash/SplashFTFont.cc b/splash/SplashFTFont.cc
index 301be9a7..2432811d 100644
--- a/splash/SplashFTFont.cc
+++ b/splash/SplashFTFont.cc
@@ -62,7 +62,8 @@ SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA,
   SplashFont(fontFileA, matA, textMatA, fontFileA->engine->aa), 
   textScale(0),
   enableFreeTypeHinting(fontFileA->engine->enableFreeTypeHinting),
-  enableSlightHinting(fontFileA->engine->enableSlightHinting)
+  enableSlightHinting(fontFileA->engine->enableSlightHinting),
+  isOk(false)
 {
   FT_Face face;
   int div;
@@ -229,6 +230,8 @@ SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA,
   textMatrix.xy = (FT_Fixed)((textMat[2] / (textScale * size)) * 65536);
   textMatrix.yy = (FT_Fixed)((textMat[3] / (textScale * size)) * 65536);
 #endif
+
+  isOk = true;
 }
 
 SplashFTFont::~SplashFTFont() {
@@ -278,7 +281,7 @@ GBool SplashFTFont::makeGlyph(int c, int xFrac, int yFrac,
   Guchar *p, *q;
   int i;
 
-  if (unlikely(textScale == 0)) {
+  if (unlikely(!isOk)) {
     return gFalse;
   }
 
diff --git a/splash/SplashFTFont.h b/splash/SplashFTFont.h
index 5f0d1976..44e1fc6b 100644
--- a/splash/SplashFTFont.h
+++ b/splash/SplashFTFont.h
@@ -11,7 +11,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2007-2009, 2011 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2007-2009, 2011, 2018 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2009 Petr Gajdos <pgajdos at novell.com>
 // Copyright (C) 2011 Andreas Hartmetz <ahartmetz at gmail.com>
 // Copyright (C) 2017 Adrian Johnson <ajohnson at redneon.com>
@@ -72,6 +72,7 @@ private:
   int size;
   GBool enableFreeTypeHinting;
   GBool enableSlightHinting;
+  GBool isOk;
 };
 
 #endif


More information about the poppler mailing list