summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c')
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c
index ce91a44571e..b6c45fe956f 100644
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c
+++ b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c
@@ -4688,8 +4688,22 @@ void readttfkerns(FILE *ttf,struct ttfinfo *info) {
left = getushort(ttf);
right = getushort(ttf);
offset = (short) getushort(ttf);
- if ( left<info->glyph_cnt && right<info->glyph_cnt &&
- chars[left]!=NULL && chars[right]!=NULL ) {
+ if ( left<0 || right<0 ) {
+ /* We've seen such buggy fonts... */
+ LogError( _("Bad kern pair: glyphs %d & %d mustn't be negative\n"),
+ left, right );
+ info->bad_gx = true;
+ } else if ( left>=info->glyph_cnt || right>=info->glyph_cnt ) {
+ /* Holes happen when reading ttc files. They are probably ok */
+ LogError( _("Bad kern pair: glyphs %d & %d must be less than %d\n"),
+ left, right, info->glyph_cnt );
+ info->bad_gx = true;
+ } else if (chars[left]==NULL || chars[right]==NULL ) {
+ /* Shouldn't happen. */
+ LogError( _("Bad kern pair: glyphs at %d & %d are null\n"),
+ left, right);
+ info->bad_gx = true;
+ } else {
kp = chunkalloc(sizeof(KernPair));
kp->sc = chars[right];
kp->off = offset;
@@ -4703,11 +4717,6 @@ void readttfkerns(FILE *ttf,struct ttfinfo *info) {
kp->next = chars[left]->kerns;
chars[left]->kerns = kp;
}
- } else if ( left>=info->glyph_cnt || right>=info->glyph_cnt ) {
- /* Holes happen when reading ttc files. They are probably ok */
- LogError( _("Bad kern pair: glyphs %d & %d must be less than %d\n"),
- left, right, info->glyph_cnt );
- info->bad_gx = true;
}
}
InfoNameOTLookup(otl,info);