summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipos
diff options
context:
space:
mode:
authorHironobu Yamashita <h.y.acetaminophen@gmail.com>2018-01-27 02:26:53 +0000
committerHironobu Yamashita <h.y.acetaminophen@gmail.com>2018-01-27 02:26:53 +0000
commit859c8a39f7184ee91ab28c339ebea52d7e0ebf1f (patch)
treec1bf967f898c98fc3bc39afabe11092b50c7d262 /Build/source/texk/dvipos
parent4f808c41f04167cf3b905cff41df95db8f791fe7 (diff)
dvipos: support new JFM spec, avoid segfault
git-svn-id: svn://tug.org/texlive/trunk@46456 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipos')
-rw-r--r--Build/source/texk/dvipos/ChangeLog5
-rw-r--r--Build/source/texk/dvipos/tfm.c11
-rw-r--r--Build/source/texk/dvipos/utils.c9
-rw-r--r--Build/source/texk/dvipos/utils.h1
4 files changed, 21 insertions, 5 deletions
diff --git a/Build/source/texk/dvipos/ChangeLog b/Build/source/texk/dvipos/ChangeLog
index d48d1cee57a..4068bdca20f 100644
--- a/Build/source/texk/dvipos/ChangeLog
+++ b/Build/source/texk/dvipos/ChangeLog
@@ -1,3 +1,8 @@
+2018-01-27 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * tfm.c, utils.[ch]: Support new JFM spec (3-byte characters
+ in TYPE > 0). This also avoids a segmentation fault.
+
2015-06-16 Peter Breitenlohner <peb@mppmu.mpg.de>
* c-auto.in (removed): Unused, replaced ...
diff --git a/Build/source/texk/dvipos/tfm.c b/Build/source/texk/dvipos/tfm.c
index a6c83aa7419..05d6dc29192 100644
--- a/Build/source/texk/dvipos/tfm.c
+++ b/Build/source/texk/dvipos/tfm.c
@@ -33,6 +33,7 @@
#define tfm_unsigned_pair() get_unsigned_pair(tfm_file)
#define tfm_signed_pair() get_signed_pair(tfm_file)
#define tfm_unsigned_triple() get_unsigned_triple(tfm_file)
+#define tfm_unsigned_triple_kanji() get_unsigned_triple_kanji(tfm_file)
#define tfm_signed_triple() get_signed_triple(tfm_file)
#define tfm_unsigned_quad() get_unsigned_quad(tfm_file)
#define tfm_signed_quad() get_signed_quad(tfm_file)
@@ -66,7 +67,7 @@ struct a_tfm {
SIGNED_QUAD *height;
SIGNED_QUAD *depth;
char *tex_name;
- UNSIGNED_PAIR *chartypes;
+ UNSIGNED_TRIPLE *chartypes;
fixword *unpacked_widths;
fixword *unpacked_heights;
fixword *unpacked_depths;
@@ -282,11 +283,11 @@ static void do_char_type_array(struct a_tfm *a_tfm)
UNSIGNED_PAIR chartype;
register int i;
- a_tfm -> chartypes = (UNSIGNED_PAIR *)calloc(65536, sizeof(UNSIGNED_PAIR));
- for (i = 0; i < 65536; i++) (a_tfm->chartypes)[i] = 0;
+ a_tfm -> chartypes = (UNSIGNED_TRIPLE *)calloc(1114112, sizeof(UNSIGNED_TRIPLE));
+ for (i = 0; i < 1114112; i++) (a_tfm->chartypes)[i] = 0;
for (i = 0; i < a_tfm->nt; i++) {
- charcode = tfm_unsigned_pair();
- chartype = tfm_unsigned_pair();
+ charcode = tfm_unsigned_triple_kanji();
+ chartype = tfm_unsigned_byte();
(a_tfm->chartypes)[charcode] = chartype;
}
}
diff --git a/Build/source/texk/dvipos/utils.c b/Build/source/texk/dvipos/utils.c
index de91f464082..563565608ae 100644
--- a/Build/source/texk/dvipos/utils.c
+++ b/Build/source/texk/dvipos/utils.c
@@ -59,6 +59,15 @@ UNSIGNED_TRIPLE get_unsigned_triple (FILE *fp)
return triple;
}
+UNSIGNED_TRIPLE get_unsigned_triple_kanji (FILE *fp)
+{
+ /* yy zz XX -> XXyyzz */
+ UNSIGNED_TRIPLE triple = get_unsigned_byte(fp);
+ triple = triple << 8; triple += get_unsigned_byte(fp);
+ triple += get_unsigned_byte(fp) << 16;
+ return triple;
+}
+
SIGNED_TRIPLE get_signed_triple (FILE *fp)
{
UNSIGNED_TRIPLE triple;
diff --git a/Build/source/texk/dvipos/utils.h b/Build/source/texk/dvipos/utils.h
index 794dde530bd..98f3b6fd6af 100644
--- a/Build/source/texk/dvipos/utils.h
+++ b/Build/source/texk/dvipos/utils.h
@@ -40,6 +40,7 @@ extern SIGNED_BYTE get_signed_byte (FILE *fp);
extern UNSIGNED_PAIR get_unsigned_pair (FILE *fp);
extern SIGNED_PAIR get_signed_pair (FILE *fp);
extern UNSIGNED_TRIPLE get_unsigned_triple (FILE *fp);
+extern UNSIGNED_TRIPLE get_unsigned_triple_kanji (FILE *fp);
extern SIGNED_TRIPLE get_signed_triple (FILE *fp);
extern UNSIGNED_QUAD get_unsigned_quad (FILE *fp);
extern SIGNED_QUAD get_signed_quad (FILE *fp);