Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Sun, 22 Apr 2012 14:05:03 -0400
From: Rich Felker <>
Subject: Re: musl 0.8.9 released

On Sun, Apr 22, 2012 at 02:19:53PM +0200, Pascal Cuoq wrote:
> On Fri, Apr 20, 2012 at 4:06 AM, Rich Felker <> wrote:
> >    Bug-fix release for a serious breakage in strtol and related
> >    functions that made it into the previous release and prevents them
> >    from handling numbers with initial spaces.
> Sorry for arriving after the battle, and it is nowhere near as serious, but:
> src/internal/floatscan.c, line 136:
> 	/* Align incomplete final B1B digit */
> 	if (k<KMAX && j) {
> The condition k<KMAX always holds. The earlier for-loop can be exited
> with at most k == KMAX-2.
> You probably meant:
>    if (k < KMAX-2 && j).
> If you took a bit of safety margin in your choice of KMAX limits, it
> seems to me that it may never matter. But if this is the case, why
> bother testing k at all?

Indeed. There's plenty of extra space in the array because it has to
be rounded up to power-of-two size to avoid expensive mod operations.
Actually, since we only ever inc/dec, I wonder if I should just
replace the masking with a conditional add/sub of KMAX after the
inc/dec; then I could eliminate all the wasted stack space by using a
much smaller value (roughly LDBL_EXP_MAX/12).

In any case, the code does need to ensure that incrementing z does not
overflow in the decimal-point-alignment code that follows, so for now
I'll just make some changes that remove the redundant check and ensure
(perhaps overly careful) that we don't wrap..


Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.