summaryrefslogtreecommitdiff
path: root/Build/source/texk/lcdf-typetools/libefont/otfpost.cc
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2010-10-05 06:59:01 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2010-10-05 06:59:01 +0000
commitd9b774f1452cf490eada5d351c56e03e4f793d75 (patch)
tree62fcf09a9c78c06dc64406c0ff55f6c3a776c199 /Build/source/texk/lcdf-typetools/libefont/otfpost.cc
parent71a9724cc032291e34911c0eead10c8b0801aad2 (diff)
lcdf-typetools 2.85 (27sep10)
git-svn-id: svn://tug.org/texlive/trunk@19999 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/lcdf-typetools/libefont/otfpost.cc')
-rw-r--r--Build/source/texk/lcdf-typetools/libefont/otfpost.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/Build/source/texk/lcdf-typetools/libefont/otfpost.cc b/Build/source/texk/lcdf-typetools/libefont/otfpost.cc
index 1497f98f059..a217576ef6b 100644
--- a/Build/source/texk/lcdf-typetools/libefont/otfpost.cc
+++ b/Build/source/texk/lcdf-typetools/libefont/otfpost.cc
@@ -140,10 +140,16 @@ Post::parse_header(ErrorHandler *errh)
const uint8_t *gni = data + HEADER_SIZE + 2;
const uint8_t *names = gni + 2 * _nglyphs;
int next_name = N_MAC_GLYPHS, g;
+ bool gni_error_reported = false;
for (int i = 0; i < _nglyphs; i++, gni += 2)
- if ((g = USHORT_AT(gni)) >= 32768)
- return errh->error("bad glyph name index in post"), -EINVAL;
- else
+ // Some fonts have more than 32768 glyphs. Although the 'post'
+ // spec says name indexes 32768-65535 are reserved, some large
+ // fonts treat those indexes as valid.
+ if ((g = USHORT_AT(gni)) >= 32768 && g >= _nglyphs) {
+ if (!gni_error_reported)
+ errh->error("bad glyph name index in post");
+ gni_error_reported = true;
+ } else
while (g >= next_name) {
if (names - data > len
|| (names + 1 + names[0]) - data > len)