From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14103 invoked from network); 7 Jun 2000 13:24:03 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 7 Jun 2000 13:24:03 -0000 Received: (qmail 20580 invoked by alias); 7 Jun 2000 13:23:52 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11796 Received: (qmail 20571 invoked from network); 7 Jun 2000 13:23:49 -0000 Date: Wed, 7 Jun 2000 15:23:33 +0200 (MET DST) Message-Id: <200006071323.PAA15126@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Felix Rosencrantz's message of Mon, 5 Jun 2000 22:31:42 -0700 (PDT) Subject: Re: PATCH: Small memory leak and doc fix Felix Rosencrantz wrote: > ... > > There is only one set of leaks that the tests still find. > These are found by the 08traps.ztst. (Sorry, I missed sending these before.) > > zcalloc [mem.c:469] > dupeprog [parse.c:2003] > dosavetrap [signals.c:675] > removetrap [signals.c:756] > unsettrap [signals.c:733] > ------------------------------ > zalloc [mem.c:453] > dupeprog [parse.c:1998] > dosavetrap [signals.c:675] > removetrap [signals.c:756] > unsettrap [signals.c:733] Seems to be an unbalanced dupeprog()/freeeprog() pair. I don't dare to touch that code, in case it might explode. > >> There seems to be some situations when the following code will see > >> uninitialized memory reads from the following stack: > >> pattern_match [compmatch.c:1035] > >> match_str [compmatch.c:577] > >> comp_match [compmatch.c:941] > >> addmatches [compcore.c:1954] > >> bin_compadd [complete.c:595] > >> I haven't looked into this, so if more details are needed let me know. > > > >Haven't had the time to look at this, but knowing the match specs used > >would help. > > I think this comes up while running _path_files. The match specs used: > m:{a-zA-Z}={A-Za-z} r:|[.,_-]=** r:[^0-9]||[0-9]=** The patch below seems to make sense, but I'm not sure if that was the problem. Felix, could you try, please? Bye Sven Index: Src/Zle/compmatch.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/compmatch.c,v retrieving revision 1.16 diff -u -r1.16 compmatch.c --- Src/Zle/compmatch.c 2000/05/29 12:42:59 1.16 +++ Src/Zle/compmatch.c 2000/06/07 13:21:13 @@ -535,7 +535,8 @@ } /* Give up if we don't have enough characters for the * line-string and the anchor. */ - if (ll < llen + alen || lw < alen + aol) + if (ll < llen + alen || + (sfx ? (lw < alen + aol) : (lw < alen || iw < aol))) continue; if (mp->flags & CMF_LEFT) { @@ -571,7 +572,8 @@ * string matched by the `*'. */ if (sfx && (savl = l[-(llen + zoff)])) l[-(llen + zoff)] = '\0'; - for (t = 0, tp = w, ct = 0, ict = lw - alen + 1; + for (t = 0, tp = w, ct = 0, + ict = lw - alen + 1 - (sfx ? aol : 0); ict; tp += add, ct++, ict--) { if ((both && -- Sven Wischnowsky wischnow@informatik.hu-berlin.de