* RE: zsh segfaults on $(( [#2] 0xDEADBEEF ))
2001-04-28 8:15 zsh segfaults on $(( [#2] 0xDEADBEEF )) Andre Pang
@ 2001-04-28 9:11 ` Andrej Borsenkow
2001-04-28 17:27 ` PATCH: " Bart Schaefer
1 sibling, 0 replies; 5+ messages in thread
From: Andrej Borsenkow @ 2001-04-28 9:11 UTC (permalink / raw)
To: zsh-workers
> 18:00 ~% echo $(( [#2] 0xDEADBEEF ))
> zsh: 6139 segmentation fault zsh
Confirmed after long pause;
bor@itsrm2% echo $(( [#2] 0xDEADBEEF ))
zsh: segmentation fault (core dumped) zsh
bor@itsrm2% dbx =zsh core
dbx V2.4C00 SINIX (Jun 19 2000)
Copyright (C) Siemens AG 1998
Base: BSD, Copyright (C) The Regents of the University of California
All rights reserved
reading symbolic information ...
Current signal in memory image is: SIGSEGV (11) (address not mapped to object,
faulting address = 0x31303131)
needed shared libraries:
/tools/lib/zsh/4.0.1-pre-3/zsh/parameter.so
/tools/lib/zsh/4.0.1-pre-3/zsh/zutil.so
/tools/lib/zsh/4.0.1-pre-3/zsh/complist.so
/tools/lib/zsh/4.0.1-pre-3/zsh/complete.so
/tools/lib/zsh/4.0.1-pre-3/zsh/zle.so
/usr/lib/libc.so.1
/lib/libnsl.so
/lib/libdl.so
/lib/libsocket.so
... reading /tools/lib/zsh/4.0.1-pre-3/zsh/parameter.so
... reading /tools/lib/zsh/4.0.1-pre-3/zsh/zutil.so
... reading /tools/lib/zsh/4.0.1-pre-3/zsh/complist.so
... reading /tools/lib/zsh/4.0.1-pre-3/zsh/complete.so
... reading /tools/lib/zsh/4.0.1-pre-3/zsh/zle.so
... reading /usr/lib/libc.so.1
... reading /lib/libnsl.so
... reading /lib/libdl.so
... reading /lib/libsocket.so
[using memory image in core]
32bit dbx - 32bit program
Type 'help' for help
(dbx32) where
arithsubst(a = "illegal address (0x31310023)
, bptr = 0x7ffee760, rest = ""), line 2012 in "/tools/src/zsh/Src/subst.c"
$b13, line 163 in "/tools/src/zsh/Src/subst.c"
$b12, line 163 in "/tools/src/zsh/Src/subst.c"
stringsubst(list = 0x7893f8, node = 0x78940c, ssub = 0), line 163 in
"/tools/src/zsh/Src/subst.c"
$b1, line 73 in "/tools/src/zsh/Src/subst.c"
prefork(list = 0x7893f8, flags = 0), line 73 in "/tools/src/zsh/Src/subst.c"
execcmd(state = 0x7ffeeca4, input = 0, output = 0, how = 18, last1 = 2), line
1742 in "/tools/src/zsh/Src/exec.c"
execpline2(state = 0x7ffeeca4, pcode = 131, how = 18, input = 0, output = 0,
last1 = 0), line 1189 in "/tools/src/zsh/Src/exec.c"
execpline(state = 0x7ffeeca4, slcode = 4098, how = 18, last1 = 0), line 982 in
"/tools/src/zsh/Src/exec.c"
execlist(state = 0x7ffeeca4, dont_change_job = 0, exiting = 0), line 826 in
"/tools/src/zsh/Src/exec.c"
execode(p = 0x7893a0, dont_change_job = 0, exiting = 0), line 729 in
"/tools/src/zsh/Src/exec.c"
$b210, line 160 in "/tools/src/zsh/Src/init.c"
.init.loop(toplevel = 1, justonce = 0), line 160 in
"/tools/src/zsh/Src/init.c"
zsh_main(argc = 1, argv = 0x7ffeeddc), line 1209 in
"/tools/src/zsh/Src/init.c"
.main.main(argc = 1, argv = 0x7ffeeddc), line 37 in
"/tools/src/zsh/Src/main.c"
__start() at 0x40a124
> 18:00 ~%
>
> after a few more seconds of playing around (i am now friends
> with Esc A):
>
> 18:02 ~% echo $(( [#2] 0x1FFFFF ))
> 2#111111111111111111111
> 18:02 ~% echo $(( [#2] 0x200000 ))
> zsh: 6192 segmentation fault zsh
>
This one works here.
-andrej
^ permalink raw reply [flat|nested] 5+ messages in thread
* PATCH: Re: zsh segfaults on $(( [#2] 0xDEADBEEF ))
2001-04-28 8:15 zsh segfaults on $(( [#2] 0xDEADBEEF )) Andre Pang
2001-04-28 9:11 ` Andrej Borsenkow
@ 2001-04-28 17:27 ` Bart Schaefer
2001-04-28 17:38 ` Bart Schaefer
1 sibling, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2001-04-28 17:27 UTC (permalink / raw)
To: Andre Pang, zsh-workers
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
^ permalink raw reply [flat|nested] 5+ messages in thread