giftcurs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [giFTcurs-devel] division by zero bug


From: Christian Häggström
Subject: Re: [giFTcurs-devel] division by zero bug
Date: Sat, 9 Oct 2004 16:43:26 +0200
User-agent: Mutt/1.5.6+20040818i

On Fri, Oct 01, 2004 at 01:36:15PM +0200, Andrzej Szombierski wrote:
> 
> While testing my giFT protocol plugin i noticed that giFTcurs crashes when 
> displaying some entries in the results window. The cause turned out to be 
> a division by zero in format_produce():
>
>                 case SPACE:
>                         width = k->space_len / k->spaces; <<< here
>                         spacefill(str, width);
>                         k->space_len -= width;
>                         k->spaces--;
>                         produced += width;
> 
> (gdb) p k->spaces
> $25 = 0
> 
> The problem lies in format_collect() - it is meant to count all the SPACE 
> entries, but this block keeps it from counting:
> 
>                 if (c.n - c.variable > k->total_len) {
>                         c.n = k->total_len + c.variable;
>                         break;
>                 }
> 
> I don't know what this code is meant to do, but it makes format_collect 
> return spaces==0 even when there are SPACE entries on the list (maybe it 
> does other bad things too, but that one makes giFTcurs crash).
> 
> I've tested giFTcurs-0.6.2, but the CVS version contains the same code so 
> it probably crashes too.

A brave person that reads format.c even with my warning :)
Well, thanks for your detailed bug report, but this have already been
discovered shortly after the release of 0.6.2. The current debian package
contains a patch to fix the problem, see for example
  http://ftp.port80.se/debian/pool/main/g/giftcurs/giftcurs_0.6.2-2.diff.gz

You may have sticky tags lying in your CVS, because nowadays the CVS is
aiming towards the new RPC client protocol. So, use the patch instead
of cvs update.

Sincerly,
--
Christian Häggström




reply via email to

[Prev in Thread] Current Thread [Next in Thread]