diff options
author | Karl Berry <karl@freefriends.org> | 2019-12-17 19:24:59 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-12-17 19:24:59 +0000 |
commit | 4c124f70e22deecce385bd0164cabbc6e1946fe0 (patch) | |
tree | d99dfcf4c332926784b2fba80f83698b6b85ad9c /Build/source/texk | |
parent | 10a7ffb1a8491cbb46e496c3aad5ef20a8cb4217 (diff) |
avoid closing already-closed \openout file
git-svn-id: svn://tug.org/texlive/trunk@53155 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r-- | Build/source/texk/web2c/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/Makefile.in | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/am/texmf.am | 8 | ||||
-rwxr-xr-x | Build/source/texk/web2c/tests/tex-closeout.test | 19 | ||||
-rw-r--r-- | Build/source/texk/web2c/tex.ch | 11 |
5 files changed, 41 insertions, 6 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog index dcf4334008a..f43e8c77bb4 100644 --- a/Build/source/texk/web2c/ChangeLog +++ b/Build/source/texk/web2c/ChangeLog @@ -1,5 +1,10 @@ 2019-12-17 Karl Berry <karl@freefriends.org> + * tex.ch (out_what [1374]): always set write_open[j]:=false + if we a_close(write_file[j]), not worrying about the subtype. + * tests/tex-closeout.test: new test. + * am/texmf.am (tex_tests): add it. + * mftraptest.test, triptest.test: rm the .base/.fmt file before remaking it, so we can't find one left over from a previous run. diff --git a/Build/source/texk/web2c/Makefile.in b/Build/source/texk/web2c/Makefile.in index 492d85bcc89..bd3c7cd3123 100644 --- a/Build/source/texk/web2c/Makefile.in +++ b/Build/source/texk/web2c/Makefile.in @@ -3585,7 +3585,7 @@ tex_ch_srcs = \ # TeX tests # -tex_tests = triptest.test tests/write18-quote-test.pl +tex_tests = triptest.test tests/write18-quote-test.pl tests/tex-closeout.test call_mf_CPPFLAGS = -DEXEPROG=\"mf.exe\" nodist_call_mf_SOURCES = callexe.c call_mf_LDADD = @@ -19068,7 +19068,7 @@ tex-tangle: tangle$(EXEEXT) tex.web tex-final.ch tangle-sh tex-final.ch: tie$(EXEEXT) $(tex_ch_srcs) $(tie_c) $(tex_ch_srcs) triptest.log: tex$(EXEEXT) dvitype$(EXEEXT) pltotf$(EXEEXT) tftopl$(EXEEXT) -tests/write18-quote-test.log: tex$(EXEEXT) +tests/write18-quote-test.log tests/tex-closeout.test: tex$(EXEEXT) trip.diffs: tex$(EXEEXT) dvitype$(EXEEXT) pltotf$(EXEEXT) tftopl$(EXEEXT) $(triptrap_diffs) $@ diff --git a/Build/source/texk/web2c/am/texmf.am b/Build/source/texk/web2c/am/texmf.am index 2ec67cbd27a..cb8dde2b4ec 100644 --- a/Build/source/texk/web2c/am/texmf.am +++ b/Build/source/texk/web2c/am/texmf.am @@ -1,6 +1,8 @@ +## $Id$ ## texk/web2c/am/texmf.am: Makefile fragment for TeX and MF. ## -## Copyright (C) 2009-2015 Peter Breitenlohner <tex-live@tug.org> +## Copyright 2015-2019 Karl Berry <tex-live@tug.org> +## Copyright 2009-2015 Peter Breitenlohner <tex-live@tug.org> ## You may freely use, modify and/or distribute this file. ## Common for MF and TeX @@ -73,9 +75,9 @@ DISTCLEANFILES += $(nodist_tex_SOURCES) tex-final.ch tex-web2c \ # TeX tests # -tex_tests = triptest.test tests/write18-quote-test.pl +tex_tests = triptest.test tests/write18-quote-test.pl tests/tex-closeout.test triptest.log: tex$(EXEEXT) dvitype$(EXEEXT) pltotf$(EXEEXT) tftopl$(EXEEXT) -tests/write18-quote-test.log: tex$(EXEEXT) +tests/write18-quote-test.log tests/tex-closeout.test: tex$(EXEEXT) EXTRA_DIST += $(tex_tests) EXTRA_DIST += tests/write18-quote.tex if TEX diff --git a/Build/source/texk/web2c/tests/tex-closeout.test b/Build/source/texk/web2c/tests/tex-closeout.test new file mode 100755 index 00000000000..c510313fa61 --- /dev/null +++ b/Build/source/texk/web2c/tests/tex-closeout.test @@ -0,0 +1,19 @@ +#! /bin/sh -vx +# $Id$ +# Copyright 2019 Karl Berry <tex-live@tug.org> +# You may freely use, modify and/or distribute this file. + +# in case we're invoked standalone instead of from make. +test -z "$srcdir" && srcdir=`cd \`dirname $0\`/.. && pwd` # web2c/ +TEXMFCNF=$srcdir/../kpathsea; export TEXMFCNF + +# Resulted in a double free with glibc on x86_64-linux. +fail=2 +./tex -ini '\batchmode \immediate\openout1=b \openout1=/tmp/a \end' + +# If TeX crashed, we won't get here. The exit status will be something +# like 134 on GNU/Linux, but we don't want to rely on that. +fail=0 + +exit $fail + diff --git a/Build/source/texk/web2c/tex.ch b/Build/source/texk/web2c/tex.ch index 6c4fadf8357..a45b99198c2 100644 --- a/Build/source/texk/web2c/tex.ch +++ b/Build/source/texk/web2c/tex.ch @@ -4381,7 +4381,16 @@ var j:small_number; {write stream number} @!old_setting:0..max_selector; @z -@x [53.1374] Disallow certain \openout filenames, and log results. +@x [53.1374] + else begin if write_open[j] then a_close(write_file[j]); + if subtype(p)=close_node then write_open[j]:=false +@y + else begin if write_open[j] then begin a_close(write_file[j]); + write_open[j]:=false; end; + if subtype(p)=close_node then do_nothing {already closed} +@z + +@x [still 53.1374] Disallow certain \openout filenames, and log results. while not a_open_out(write_file[j]) do prompt_file_name("output file name",".tex"); write_open[j]:=true; |