about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-09-10 16:02:27 +0100
committerPeter Stephenson <pws@zsh.org>2015-09-10 16:02:27 +0100
commit86229fdf09e2c69576000b0f83edb35148096452 (patch)
tree08b0e0d41420875bce3eabb61f55943d5235f45f
parentca9fdda4088c7e6ff8cccdf59bbe770fe8e739da (diff)
downloadzsh-86229fdf09e2c69576000b0f83edb35148096452.tar.gz
zsh-86229fdf09e2c69576000b0f83edb35148096452.tar.xz
zsh-86229fdf09e2c69576000b0f83edb35148096452.zip
36468: Fix infinite loop exiting from Zle widget.
If the exit was while we were waiting to complete a lexical expression
we might not exit from the loop.
-rw-r--r--ChangeLog4
-rw-r--r--Src/hist.c6
2 files changed, 10 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b9bb8a575..bf7f27edf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2015-09-10  Peter Stephenson  <p.stephenson@samsung.com>
 
+	* 36468: Src/hist.c: Infinite loop if we tried to exit from a
+	Zle widget but the lexer thought the current lexical expression
+	needed finishing.
+
 	* 36460: Test/E01options.ztst: Discard benign error on failure
 	to write to pipe with no one reading.
 
diff --git a/Src/hist.c b/Src/hist.c
index 75e809c48..9c42d85c9 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -390,6 +390,12 @@ ihgetc(void)
 {
     int c = ingetc();
 
+    if (exit_pending)
+    {
+	lexstop = 1;
+	errflag |= ERRFLAG_ERROR;
+	return ' ';
+    }
     qbang = 0;
     if (!stophist && !(inbufflags & INP_ALIAS)) {
 	/* If necessary, expand history characters. */