summaryrefslogtreecommitdiff
path: root/fofi
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2018-05-01 02:46:17 +0200
committerAlbert Astals Cid <aacid@kde.org>2018-05-01 02:46:17 +0200
commit60b4fe65bc9dc9b82bbadf0be2e3781be796a13d (patch)
tree1df4774c731ff57fbaff9c11e6de3ee23343a1e2 /fofi
parent8429a67536b7c2f6d752e4a522ee98e6f76a40f9 (diff)
FoFiType1C::cvtGlyph: Fix infinite recursion on malformed documents
Bugs #104942, #103238
Diffstat (limited to 'fofi')
-rw-r--r--fofi/FoFiType1C.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/fofi/FoFiType1C.cc b/fofi/FoFiType1C.cc
index 03e77993..b14561ff 100644
--- a/fofi/FoFiType1C.cc
+++ b/fofi/FoFiType1C.cc
@@ -13,7 +13,7 @@
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
-// Copyright (C) 2009, 2010, 2017 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2009, 2010, 2017, 2018 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2012 Thomas Freitag <Thomas.Freitag@alfa.de>
//
// To see a description of the changes please see the Changelog file that
@@ -32,6 +32,7 @@
#include <math.h>
#include "goo/gmem.h"
#include "goo/gstrtod.h"
+#include "goo/GooLikely.h"
#include "goo/GooString.h"
#include "poppler/Error.h"
#include "FoFiEncodings.h"
@@ -1361,7 +1362,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf,
--nOps;
ok = gTrue;
getIndexVal(subrIdx, k, &val, &ok);
- if (ok) {
+ if (likely(ok && val.pos != offset)) {
cvtGlyph(val.pos, val.len, charBuf, subrIdx, pDict, gFalse);
}
} else {
@@ -1596,7 +1597,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf,
--nOps;
ok = gTrue;
getIndexVal(&gsubrIdx, k, &val, &ok);
- if (ok) {
+ if (likely(ok && val.pos != offset)) {
cvtGlyph(val.pos, val.len, charBuf, subrIdx, pDict, gFalse);
}
} else {