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

Re: seg fault with completion



Oliver Kiddle wrote:

> This is in version 4.0.2 too so is not new.
> 
> s=( $a[(<tab> )
> cursor positioned where I have put `<tab>'.

Memory problem and hence not always reproducible.

It was using a pointer to compsuffix which might be freed by
ignore_suffix().

And that loop shouldn't be using `str' anyway, it's `more' there.

This'll go into 4.0.x, too.


Bye
  Sven

Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.65
diff -u -r1.65 computil.c
--- Src/Zle/computil.c	2001/07/19 08:40:37	1.65
+++ Src/Zle/computil.c	2001/07/20 10:48:53
@@ -2615,19 +2615,21 @@
                     ign = strlen(as);
             }
         }
+        more = dupstring(more);
+
         if (ign)
             ignore_suffix(ign);
 
         while (more && *more) {
-            if ((val = cv_next(d, &str, &arg))) {
+            if ((val = cv_next(d, &more, &arg))) {
                 zaddlinknode(state.vals, ztrdup(val->name));
                 if (arg) {
-                    if (str) {
-                        char sav = str[-1];
+                    if (more) {
+                        char sav = more[-1];
 
-                        str[-1] = '\0';
+                        more[-1] = '\0';
                         zaddlinknode(state.vals, ztrdup(arg));
-                        str[-1] = sav;
+                        more[-1] = sav;
                     } else {
                         zaddlinknode(state.vals, tricat(arg, compsuffix, ""));
                         nosfx = 1;

-- 
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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