From b903bfd5c7a0dee62ddbea3568b7c06afef7afe6 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Thu, 2 Feb 2012 09:02:55 +0000 Subject: ofm2opl: Allow arbitrarily long OFM files and avoid Segmentation fault TFtoPL, ofm2opl, opl2ofm, ovf2ovp: Minor bug fixes and clean up git-svn-id: svn://tug.org/texlive/trunk@25275 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/ChangeLog | 2 ++ Build/source/texk/web2c/omegaware/ChangeLog | 10 ++++++++++ Build/source/texk/web2c/omegaware/ofm2opl.ch | 11 ++++++++--- Build/source/texk/web2c/omegaware/ofm2opl.web | 2 +- Build/source/texk/web2c/omegaware/opl2ofm.web | 1 - Build/source/texk/web2c/omegaware/ovf2ovp.web | 2 +- Build/source/texk/web2c/tftopl.ch | 1 - 7 files changed, 22 insertions(+), 7 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog index 73c38bb40bb..1134c60a997 100644 --- a/Build/source/texk/web2c/ChangeLog +++ b/Build/source/texk/web2c/ChangeLog @@ -3,6 +3,8 @@ * tex.ch, gftodvi.ch: Ensure dvi file size < 2GB. * mf.ch: Ensure gf file size < 2GB. + * tftopl.ch: Remove unused constant tfm_size. + 2012-01-24 Karl Berry * doc/web2c.texi (Common options): remove doc for the long-since diff --git a/Build/source/texk/web2c/omegaware/ChangeLog b/Build/source/texk/web2c/omegaware/ChangeLog index bce4803320c..ab8c9ad0af3 100644 --- a/Build/source/texk/web2c/omegaware/ChangeLog +++ b/Build/source/texk/web2c/omegaware/ChangeLog @@ -1,3 +1,13 @@ +2012-02-01 Peter Breitenlohner + + * ofm2opl.web, ovf2ovp.web: Both nl and lig_size are in words, + so the multiplication by 4 is not needed. + + * ofm2opl.ch: Handle tfm_file_array as in TFtoPL, i.e., allocate + with a small initial size and reallocate as needed. + + * ofm2opl.ch, opl2ofm.web: Remove unused constant tfm_size. + 2012-01-24 Peter Breitenlohner * opl2ofm.web, ovp2ovf.web: Interpret "--" as "+", not "-". diff --git a/Build/source/texk/web2c/omegaware/ofm2opl.ch b/Build/source/texk/web2c/omegaware/ofm2opl.ch index c690e9cd387..cde0495cd88 100644 --- a/Build/source/texk/web2c/omegaware/ofm2opl.ch +++ b/Build/source/texk/web2c/omegaware/ofm2opl.ch @@ -53,10 +53,15 @@ procedure initialize; {this procedure gets things started properly} kpse_init_prog ('OFM2OPL', 0, nil, nil); {We |xrealloc| when we know how big the file is. The 1000 comes from the negative lower bound.} - tfm_file_array := cast_to_byte_pointer (xmalloc (2000000)); + tfm_file_array := cast_to_byte_pointer (xmalloc (1009)); parse_arguments; @z +@x [4] Drop unused constant. +@!tfm_size=2000000; {maximum length of |tfm| data, in bytes} +@y +@z + @x [7] Open the TFM file. @ On some systems you may have to do something special to read a packed file of bytes. For example, the following code didn't work @@ -141,8 +146,8 @@ end; if 4*lf-1>tfm_size then abort('The file is bigger than I can handle!'); @.The file is bigger...@> @y -{|tfm_file_array - := cast_to_byte_pointer (xrealloc (tfm_file_array, 4 * lf - 1 + 1108));|} +tfm_file_array + := cast_to_byte_pointer (xrealloc (tfm_file_array, 4 * lf - 1 + 1002)); @z % [27, 28] Change strings to C char pointers. The Pascal strings are diff --git a/Build/source/texk/web2c/omegaware/ofm2opl.web b/Build/source/texk/web2c/omegaware/ofm2opl.web index c34cc817da9..3d0ee70bcc6 100644 --- a/Build/source/texk/web2c/omegaware/ofm2opl.web +++ b/Build/source/texk/web2c/omegaware/ofm2opl.web @@ -627,7 +627,7 @@ if lf<>(header_length+lh+ncw+nw+nh+nd+ni+nlw+nk+neew+np+ @.Subfile sizes don't add up...@> if lh<2 then abort('The header length is only ',lh:1,'!'); @.The header length...@> -if nl>4*lig_size then +if nl>lig_size then abort('The lig/kern program is longer than I can handle!'); @.The lig/kern program...@> if (bc>ec+1)or(ec>top_char) then abort('The character code range ', diff --git a/Build/source/texk/web2c/omegaware/opl2ofm.web b/Build/source/texk/web2c/omegaware/opl2ofm.web index 9d0dd6f93f4..e73f058c8b8 100644 --- a/Build/source/texk/web2c/omegaware/opl2ofm.web +++ b/Build/source/texk/web2c/omegaware/opl2ofm.web @@ -126,7 +126,6 @@ reduce \.{PLtoTF}'s capacity. @!hash_size=130003; {preferably a prime number, a bit larger than the number of character pairs in lig/kern steps} @!hash_mult=16007; {another prime} -@!tfm_size=2000000; {maximum length of |tfm| data, in bytes} @!lig_size=800000; {maximum length of |lig_kern| program, in words} @!max_char=65535; {the largest character number in a font} @!xmax_char=65536; {|max_char|+1} diff --git a/Build/source/texk/web2c/omegaware/ovf2ovp.web b/Build/source/texk/web2c/omegaware/ovf2ovp.web index e6048c024fe..30fc71c9e03 100644 --- a/Build/source/texk/web2c/omegaware/ovf2ovp.web +++ b/Build/source/texk/web2c/omegaware/ovf2ovp.web @@ -777,7 +777,7 @@ if lf<>(header_length+lh+ncw+nw+nh+nd+ni+nlw+nk+neew+np+ @.Subfile sizes don't add up...@> if lh<2 then abort('The header length is only ',lh:1,'!'); @.The header length...@> -if nl>4*lig_size then +if nl>lig_size then abort('The lig/kern program is longer than I can handle!'); @.The lig/kern program...@> if (bc>ec+1)or(ec>top_char) then abort('The character code range ', diff --git a/Build/source/texk/web2c/tftopl.ch b/Build/source/texk/web2c/tftopl.ch index 3dcec53f165..33ce0dc564a 100644 --- a/Build/source/texk/web2c/tftopl.ch +++ b/Build/source/texk/web2c/tftopl.ch @@ -64,7 +64,6 @@ procedure initialize; {this procedure gets things started properly} @!hash_size=5003; {preferably a prime number, a bit larger than the number of character pairs in lig/kern steps} @y -@!tfm_size=150000; {maximum length of |tfm| data, in bytes} @!lig_size=32510; {maximum length of |lig_kern| program, in words ($<2^{15}$)} @!hash_size=32579; {preferably a prime number, a bit larger than the number of character pairs in lig/kern steps} -- cgit v1.2.3