Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: BUG: compdescribe/computils.c causing seg fault
- X-seq: zsh-workers 16582
- From: Sven Wischnowsky <wischnow@xxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: BUG: compdescribe/computils.c causing seg fault
- Date: Thu, 7 Feb 2002 09:37:15 +0100
- In-reply-to: <20020206063613.11652.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20020206063613.11652.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
Felix Rosencrantz wrote:
> There is a bug in compdescribe. One place that it is tickled is on line 109 in
> _describe. I encountered this bug will trying to complete args to the configure
> command as "./configure --<TAB>"
>
> This bug causes a seg. fault. The problem happens in the computils.c file.
>
> 616 int dlen = columns - cd_state.gpre - cd_state.slen;
>
> At line 616, the computed value of dlen is negative which causes problems.
> It's not clear to me why this should always be a positive number. The value of
> cd_state.gpre is set at line 316, and is just a sum. There is nothing that
> limits the value. I was seeing cd_state.gpre have a value of 360+ (this was
> the sum of 24 values from wids[]), while columns was 80.
Oops. compdescribe should be able to go back to displaying one match
per line when the lines get too long.
Bye
Sven
Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.74
diff -u -r1.74 computil.c
--- Src/Zle/computil.c 8 Jan 2002 15:29:46 -0000 1.74
+++ Src/Zle/computil.c 7 Feb 2002 08:36:35 -0000
@@ -121,7 +121,7 @@
{
Cdset set1, set2;
Cdstr str1, str2, *strp;
- int num;
+ int num, len;
for (set1 = cd_state.sets; set1; set1 = set1->next) {
for (str1 = set1->strs; str1; str1 = str1->next) {
@@ -129,6 +129,7 @@
continue;
num = 1;
+ len = str1->len;
strp = &(str1->other);
for (set2 = set1; set2; set2 = set2->next)
@@ -138,10 +139,18 @@
str1->kind = 1;
str2->kind = 2;
num++;
+ len += str2->len;
*strp = str2;
strp = &(str2->other);
}
*strp = NULL;
+ len += num * 2 + cd_state.slen;
+
+ if (len >= columns) {
+ cd_state.groups = 0;
+
+ return;
+ }
if (num > 1)
cd_state.groups++;
else
--
Sven Wischnowsky wischnow@xxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author