summaryrefslogtreecommitdiff
path: root/splash
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2018-06-22 23:55:09 +0200
committerAlbert Astals Cid <aacid@kde.org>2018-06-22 23:55:09 +0200
commitaf4d5f31705dcfd65319da430f87744b5c1f3616 (patch)
tree37c6ac15d6724fa8d2a8741827e48737fb99b2cb /splash
parent0281c02b9a1cd776c45ca1fd2f5eeea15f6827a6 (diff)
SplashFTFont::makeGlyph: Bail out if constructor returned early
fixes oss-fuzz/8811
Diffstat (limited to 'splash')
-rw-r--r--splash/SplashFTFont.cc7
-rw-r--r--splash/SplashFTFont.h3
2 files changed, 7 insertions, 3 deletions
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@kde.org>
+// Copyright (C) 2007-2009, 2011, 2018 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com>
// Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com>
// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com>
@@ -72,6 +72,7 @@ private:
int size;
GBool enableFreeTypeHinting;
GBool enableSlightHinting;
+ GBool isOk;
};
#endif