Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: zsh segfaults on $(( [#2] 0xDEADBEEF ))



Well, this one wasn't difficult, at least.


Index: Src/params.c
===================================================================
--- Src/params.c	2001/04/26 04:20:57	1.4
+++ Src/params.c	2001/04/28 17:16:06
@@ -1651,7 +1651,7 @@
 void
 setnumvalue(Value v, mnumber val)
 {
-    char buf[DIGBUFSIZE], *p;
+    char buf[BDIGBUFSIZE], *p;
 
     if (v->pm->flags & PM_READONLY) {
 	zerr("read-only variable: %s", v->pm->nam, 0);
Index: Src/subst.c
===================================================================
--- Src/subst.c	2001/04/26 04:20:58	1.2
+++ Src/subst.c	2001/04/28 17:16:03
@@ -1994,7 +1994,7 @@
 arithsubst(char *a, char **bptr, char *rest)
 {
     char *s = *bptr, *t;
-    char buf[DIGBUFSIZE], *b = buf;
+    char buf[BDIGBUFSIZE], *b = buf;
     mnumber v;
 
     singsub(&a);
Index: Src/system.h
===================================================================
--- Src/system.h	2001/04/21 22:22:54	1.2
+++ Src/system.h	2001/04/28 17:15:14
@@ -406,8 +406,10 @@
 /* DIGBUFSIZ is the length of a buffer which can hold the -LONG_MAX-1 *
  * (or with ZSH_64_BIT_TYPE maybe -LONG_LONG_MAX-1)                   *
  * converted to printable decimal form including the sign and the     *
- * terminating null character. Below 0.30103 > lg 2.                  */
+ * terminating null character. Below 0.30103 > lg 2.                  *
+ * BDIGBUFSIZE is for a number converted to printable binary form.    */
 #define DIGBUFSIZE ((int)(((sizeof(zlong) * 8) - 1) * 0.30103) + 3)
+#define BDIGBUFSIZE ((int)((sizeof(zlong) * 8) + 3))
 
 /* If your stat macros are broken, we will *
  * just undefine them.                     */

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



Messages sorted by: Reverse Date, Date, Thread, Author