about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2003-12-17 20:47:39 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2003-12-17 20:47:39 +0000
commit76bd48d67422c28d54ef75ef313b8763f6d60760 (patch)
treecd4cbd7854be17153843ca3f61f8d09f2c6d1c25
parentf8c004aa611908c9134a2174971ba80f9f8a0403 (diff)
downloadzsh-76bd48d67422c28d54ef75ef313b8763f6d60760.tar.gz
zsh-76bd48d67422c28d54ef75ef313b8763f6d60760.tar.xz
zsh-76bd48d67422c28d54ef75ef313b8763f6d60760.zip
19308: zsh crashes with $((##))
-rw-r--r--ChangeLog4
-rw-r--r--Src/utils.c5
-rw-r--r--Test/C01arith.ztst8
3 files changed, 16 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9047b8151..2e695e1c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2003-12-17  Oliver Kiddle  <opk@zsh.org>
+
+	* 19308: Src/utils.c, Test/C01arith.ztst: zsh crashes with $((##))
+
 2003-12-16  Oliver Kiddle  <opk@zsh.org>
 
 	* 19299: Completion/Unix/Command/_mount: try to handle
diff --git a/Src/utils.c b/Src/utils.c
index 6b550a2cb..30519f247 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -3643,7 +3643,10 @@ getkeystring(char *s, int *len, int fromwhere, int *misc)
     }
     DPUTS(fromwhere == 4, "BUG: unterminated $' substitution");
     *t = '\0';
-    *len = t - buf;
+    if (fromwhere == 6)
+      *misc = 0;
+    else
+      *len = t - buf;
     return buf;
 }
 
diff --git a/Test/C01arith.ztst b/Test/C01arith.ztst
index 8558d66a8..d431daae0 100644
--- a/Test/C01arith.ztst
+++ b/Test/C01arith.ztst
@@ -68,6 +68,14 @@
 0:#, ## and $#
 >117
 
+  print $((##))
+0:## without following character
+>0
+
+  print $((## ))
+0:## followed by a space
+>32
+
   integer i
   (( i = 3 + 5 * 1.75 ))
   print $i