summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Kew <jfkthame@googlemail.com>2007-06-27 12:16:43 +0000
committerJonathan Kew <jfkthame@googlemail.com>2007-06-27 12:16:43 +0000
commit95f629d7b4942af1bb6000f0cc781510c92a3023 (patch)
tree97217aace0ee711543543e7cdccb25e546c91c32
parent83775b3c9a877e38288b5c82b26f09624e469a29 (diff)
fix xdvipdfmx crash with certain broken truetype fonts
git-svn-id: svn://tug.org/texlive/branches/branch2007@4512 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/xdvipdfmx/src/tt_cmap.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Build/source/texk/xdvipdfmx/src/tt_cmap.c b/Build/source/texk/xdvipdfmx/src/tt_cmap.c
index 1681dad8230..ea8fb0e304e 100644
--- a/Build/source/texk/xdvipdfmx/src/tt_cmap.c
+++ b/Build/source/texk/xdvipdfmx/src/tt_cmap.c
@@ -303,6 +303,9 @@ lookup_cmap4 (struct cmap4 *map, USHORT cc)
if (cc >= map->startCount[i]) {
if (map->idRangeOffset[i] == 0) {
gid = (cc + map->idDelta[i]) & 0xffff;
+ } else if (cc == 0xffff && map->idRangeOffset[i] == 0xffff) {
+ /* this is for protection against some old broken fonts... */
+ gid = 0;
} else {
j = map->idRangeOffset[i] - (segCount - i) * 2;
j = (cc - map->startCount[i]) + (j / 2);
@@ -630,6 +633,9 @@ load_cmap4 (struct cmap4 *map,
ch = c0 + j;
if (map->idRangeOffset[i] == 0) {
gid = (ch + map->idDelta[i]) & 0xffff;
+ } else if (c0 == 0xffff && c1 == 0xffff && map->idRangeOffset[i] == 0xffff) {
+ /* this is for protection against some old broken fonts... */
+ gid = 0;
} else {
gid = (map->glyphIndexArray[j+d] +
map->idDelta[i]) & 0xffff;
@@ -952,6 +958,9 @@ create_ToUnicode_cmap4 (struct cmap4 *map,
ch = c0 + j;
if (map->idRangeOffset[i] == 0) {
gid = (ch + map->idDelta[i]) & 0xffff;
+ } else if (c0 == 0xffff && c1 == 0xffff && map->idRangeOffset[i] == 0xffff) {
+ /* this is for protection against some old broken fonts... */
+ gid = 0;
} else {
gid = (map->glyphIndexArray[j+d] +
map->idDelta[i]) & 0xffff;