about summary refs log tree commit diff
diff options
context:
space:
mode:
-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