summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2017-09-10 22:11:43 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2017-09-10 22:11:43 +0000
commit27132e449e4be290ca67fa3b963d16b029363d9a (patch)
tree432d6a91c059ac40afceb874e7f1d368c91fc6e6 /Build
parent23056da81dd216ac377e040b70c9b78e01c94186 (diff)
pltotf.ch: web2c extends the range 0..32767 into short (-32768..32767), so add a test of overflow. (H. Yamashita).
git-svn-id: svn://tug.org/texlive/trunk@45267 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/web2c/ChangeLog6
-rw-r--r--Build/source/texk/web2c/pltotf.ch15
2 files changed, 21 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog
index 76a2d802378..b6432ed9d4a 100644
--- a/Build/source/texk/web2c/ChangeLog
+++ b/Build/source/texk/web2c/ChangeLog
@@ -1,3 +1,9 @@
+2017-09-10 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * pltotf.ch: web2c extends the range of 'lf' from 0..32767
+ into short (-32768..32767), but the overflow here ends up in
+ Bad metric (TFM) file. So add a test.
+
2017-03-27 Karl Berry <karl@freefriends.org>
* Makefile.am (AM_TESTS_ENVIRONMENT): use instead of TESTS_ENVIRONMENT.
diff --git a/Build/source/texk/web2c/pltotf.ch b/Build/source/texk/web2c/pltotf.ch
index 7668fad9034..587b332c6d4 100644
--- a/Build/source/texk/web2c/pltotf.ch
+++ b/Build/source/texk/web2c/pltotf.ch
@@ -188,6 +188,21 @@ endif('notdef')
@d out(#)==putbyte(#,tfm_file)
@z
+% [130] web2c extends the range of 'lf' from 0..32767 into
+% short (-32768..32767), but the overflow here ends up in
+% Bad metric (TFM) file. So we add test here.
+@x
+lf:=6+lh+(ec-bc+1)+memory[width]+memory[height]+memory[depth]+
+memory[italic]+nl+lk_offset+nk+ne+np;
+@y
+lf:=6+lh+(ec-bc+1)+memory[width]+memory[height]+memory[depth]+
+memory[italic]+nl+lk_offset+nk+ne+np;
+if lf<0 then begin
+ print_ln('The total number of words in the TFM file too large!');
+ uexit(1);
+ end
+@z
+
@x [136] Fix output of reals.
@p procedure out_scaled(x:fix_word); {outputs a scaled |fix_word|}
var @!n:byte; {the first byte after the sign}