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

Re: Completion problem on right hand side of assignment.



Tanaka Akira wrote:

> ...
> rascal% A=Doc/Zsh/zsh: segmentation fault (core dumped)  ./Src/zsh -f
> Z:akr@rascal% 
> ...
>   BUG: attempt to free already free storage
>   BUG: attempt to free storage at invalid address

Seems like clwnum is off-by-one after parsing an assignment. This
caused compwords to be allocated one field too short in callcompfunc
and then the NULL pointer terminating it could be overwritten.

This should fix it.

Bye
 Sven

diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Mon May  3 11:07:15 1999
+++ Src/Zle/zle_tricky.c	Mon May  3 11:07:50 1999
@@ -4360,7 +4360,7 @@
 
 	    PERMALLOC {
 		q = compwords = (char **)
-		    zalloc((clwnum - aadd + 1) * sizeof(char *));
+		    zalloc((clwnum + 1) * sizeof(char *));
 		for (p = clwords + aadd; *p; p++, q++) {
 		    tmp = dupstring(*p);
 		    untokenize(tmp);

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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