texlive[53155] Build/source/texk/web2c: avoid closing already-closed

commits+karl at tug.org commits+karl at tug.org
Tue Dec 17 20:24:59 CET 2019


Revision: 53155
          http://tug.org/svn/texlive?view=revision&revision=53155
Author:   karl
Date:     2019-12-17 20:24:59 +0100 (Tue, 17 Dec 2019)
Log Message:
-----------
avoid closing already-closed \openout file

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/ChangeLog
    trunk/Build/source/texk/web2c/Makefile.in
    trunk/Build/source/texk/web2c/am/texmf.am
    trunk/Build/source/texk/web2c/tex.ch

Added Paths:
-----------
    trunk/Build/source/texk/web2c/tests/tex-closeout.test

Property Changed:
----------------
    trunk/Build/source/texk/web2c/am/texmf.am

Modified: trunk/Build/source/texk/web2c/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/ChangeLog	2019-12-17 19:06:20 UTC (rev 53154)
+++ trunk/Build/source/texk/web2c/ChangeLog	2019-12-17 19:24:59 UTC (rev 53155)
@@ -1,5 +1,10 @@
 2019-12-17  Karl Berry  <karl at 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.

Modified: trunk/Build/source/texk/web2c/Makefile.in
===================================================================
--- trunk/Build/source/texk/web2c/Makefile.in	2019-12-17 19:06:20 UTC (rev 53154)
+++ trunk/Build/source/texk/web2c/Makefile.in	2019-12-17 19:24:59 UTC (rev 53155)
@@ -3585,7 +3585,7 @@
 
 # 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-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) $@

Modified: trunk/Build/source/texk/web2c/am/texmf.am
===================================================================
--- trunk/Build/source/texk/web2c/am/texmf.am	2019-12-17 19:06:20 UTC (rev 53154)
+++ trunk/Build/source/texk/web2c/am/texmf.am	2019-12-17 19:24:59 UTC (rev 53155)
@@ -1,6 +1,8 @@
+## $Id$
 ## texk/web2c/am/texmf.am: Makefile fragment for TeX and MF.
 ##
-## Copyright (C) 2009-2015 Peter Breitenlohner <tex-live at tug.org>
+## Copyright 2015-2019 Karl Berry <tex-live at tug.org>
+## Copyright 2009-2015 Peter Breitenlohner <tex-live at tug.org>
 ## You may freely use, modify and/or distribute this file.
 
 ## Common for MF and TeX
@@ -73,9 +75,9 @@
 
 # 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


Property changes on: trunk/Build/source/texk/web2c/am/texmf.am
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision
\ No newline at end of property
Added: trunk/Build/source/texk/web2c/tests/tex-closeout.test
===================================================================
--- trunk/Build/source/texk/web2c/tests/tex-closeout.test	                        (rev 0)
+++ trunk/Build/source/texk/web2c/tests/tex-closeout.test	2019-12-17 19:24:59 UTC (rev 53155)
@@ -0,0 +1,19 @@
+#! /bin/sh -vx
+# $Id$
+# Copyright 2019 Karl Berry <tex-live at 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
+


Property changes on: trunk/Build/source/texk/web2c/tests/tex-closeout.test
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision
\ No newline at end of property
Modified: trunk/Build/source/texk/web2c/tex.ch
===================================================================
--- trunk/Build/source/texk/web2c/tex.ch	2019-12-17 19:06:20 UTC (rev 53154)
+++ trunk/Build/source/texk/web2c/tex.ch	2019-12-17 19:24:59 UTC (rev 53155)
@@ -4381,7 +4381,16 @@
     @!old_setting:0..max_selector;
 @z
 
- at x [53.1374] Disallow certain \openout filenames, and log results.
+ at 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
+ at 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}
+ at z
+
+ at 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;



More information about the tex-live-commits mailing list