summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-07-06 22:42:47 +0000
committerKarl Berry <karl@freefriends.org>2020-07-06 22:42:47 +0000
commit1eef92044ea0ed10907df5c2834e52d70a196154 (patch)
tree4384713145b0be21d18853952d07a40306425901
parentdb118169e8feb0f467c6fa1c23cce13ea65afac1 (diff)
avoid seg fault in unusual interaction sequence
git-svn-id: svn://tug.org/texlive/trunk@55767 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/web2c/ChangeLog11
-rw-r--r--Build/source/texk/web2c/tex.ch21
2 files changed, 31 insertions, 1 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog
index 97740344552..e48e8610678 100644
--- a/Build/source/texk/web2c/ChangeLog
+++ b/Build/source/texk/web2c/ChangeLog
@@ -1,3 +1,14 @@
+2020-07-06 Karl Berry <karl@freefriends.org>
+
+ * tex.ch (<Get user's advice...>): return early if
+ interaction<>error_stop_mode; else a nested error()
+ call in unusual interactive sequences can mess up
+ the selector value, ultimately causing a segmentation fault
+ from writing to a closed stream \write15. Fix primarily
+ from David Fuchs.
+ https://tex.stackexchange.com/questions/551313/
+ https://tug.org/pipermail/tex-live/2020-June/045876.html
+
2020-06-22 Karl Berry <karl@freefriends.org>
* doc/web2c.texi (Runtime options): move from install.texi,
diff --git a/Build/source/texk/web2c/tex.ch b/Build/source/texk/web2c/tex.ch
index 55ffc95aa32..9d8b48b98dc 100644
--- a/Build/source/texk/web2c/tex.ch
+++ b/Build/source/texk/web2c/tex.ch
@@ -853,7 +853,26 @@ if (halt_on_error_p) then begin
end;
@z
-@x [6.84] l.1888 - Implement the switch-to-editor option.
+% Original reports:
+% https://tex.stackexchange.com/questions/551313/
+% https://tug.org/pipermail/tex-live/2020-June/045876.html
+%
+% This will probably be fixed by DEK in the 2021 tuneup in a different
+% way (so we'll have to remove or alter this change), but the interaction
+% sequence in the reports above causes a segmentation fault in web2c -
+% writing to the closed \write15 stream because we wrongly decrement
+% selector from 16 to 15 in term_input, due to the lack of this check in
+% a recursive error() call.
+%
+@x [6.83] l.1893 - avoid wrong interaction
+loop@+begin continue: clear_for_error_prompt; prompt_input("? ");
+@y
+loop@+begin continue:
+if interaction<>error_stop_mode then return;
+clear_for_error_prompt; prompt_input("? ");
+@z
+
+@x [6.84] l.1904 - Implement the switch-to-editor option.
line ready to be edited. But such an extension requires some system
wizardry, so the present implementation simply types out the name of the
file that should be