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

Re: [leafnode-list] [ANNOUNCE] First Leafnode-2.0 beta version



On Fri, Oct 27, 2000 at 05:59:06PM +0200, Cornelius Krasel wrote:
> Joerg Dietrich wrote the following patch for helpfindxover():
> -    if ( article < xoverinfo[new].artno )
> -       return helpfindxover( article, low, new-1 );
> -    else
> +    if ( article < xoverinfo[new].artno ) {
> +       if ( new > 0 )
> +           return helpfindxover( article, low, new-1 );
> +       else
> +           return -1;
> +    } else
>         return helpfindxover( article, new+1, high );
>  }
> 
> I don't think that this helps anything and I will now explain why.

Well, a reproducable segfault is gone...

> The very first line of the helpfindxover() function says:
> 
>     if ( low > high )
> 	return -1;
> 
> Afterwards, neither "high" nor "low" are modified. "new" is therefore
> calculated from "high" and "low" according to the first line of the
> patch and will always be >= 0. xoverinfo[0] is a valid entry,
> therefore it must be accessible.
> 
> Or am I missing something?

Yes. Look at the way new is calculated. If art is not present in
the xoverinfo array new=0 is a possible outcome. If you then call
helpfindxover( article, low, new-1 );
new will not be -1 as it as declared as an unsigned long, but
UNSIGNED_LONG_MAX, which for sure leads to a segfault when you
try to acces xoverinfo[new].artno.

Regards,
	Jo:rg

-- 
Fortune cookie of the day:
One family builds a wall, two families enjoy it.

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list