about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2015-07-25 21:50:55 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2015-07-25 21:50:55 +0100
commitb3aa3b77916007703b341bfd30c3647bdc355bc8 (patch)
treefef4548806c197d096bb99d10441d5ac5fe69a0e
parentdd8079e0415cf213d9bb5d41d1ad95c04b774f3a (diff)
downloadzsh-b3aa3b77916007703b341bfd30c3647bdc355bc8.tar.gz
zsh-b3aa3b77916007703b341bfd30c3647bdc355bc8.tar.xz
zsh-b3aa3b77916007703b341bfd30c3647bdc355bc8.zip
35910: Don't add to raw lex buffer if lex stopped.
This was causing a segmentation violation in completion when parsing
an incomplete math expression, e.g. 'echo $((3*4)<TAB>'.
-rw-r--r--ChangeLog4
-rw-r--r--Src/input.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 899ff08e5..bffa104bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2015-07-25  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
+	* 35910: Src/input.c: Don't add to raw lex buffer if lex
+	stopped.  Fixes crash on completion of incomplete
+	math expresion e.g. '$((3*4)'.
+
 	* 35909: Src/utils.c: fix $((...) completion in _expand by
 	normalising quoting of the math expression containing tokens.
 
diff --git a/Src/input.c b/Src/input.c
index 613f89a25..1efabadeb 100644
--- a/Src/input.c
+++ b/Src/input.c
@@ -222,7 +222,8 @@ ingetc(void)
 	if (inputline())
 	    break;
     }
-    zshlex_raw_add(lastc);
+    if (!lexstop)
+	zshlex_raw_add(lastc);
     return lastc;
 }