summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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}