This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Avoid SIGFPE in wordexp [BZ #18100]


On 03/20/2015 04:37 PM, Mike Frysinger wrote:
> On 20 Mar 2015 15:17, Florian Weimer wrote:
> 
> change looks fine ... two minor questions below

Thanks.

>> --- a/posix/wordexp-test.c +++ b/posix/wordexp-test.c +  /*
>> Integer overflow in division.  */ +  { +    static const char
>> *const numbers[] = { +      "0", +      "1", +      "65536", +
>> "2147483648", +      "4294967296" +      "9223372036854775808", +
>> "18446744073709551616", +
>> "170141183460469231731687303715884105728", +
>> "340282366920938463463374607431768211456", +      NULL +    };
> 
> should there be tests for negative numeric limits ?

These tests are for then negative limit, the minus sign is patched
into the pattern.  It will be gone on success, that's why it's not
included in the reference array.

>> +    for (const char *const *num = numbers; *num; ++num)

(â*numâ should be â*num != NULLâ.)

> could use ARRAY_SIZE(numbers) rather than a NULL sentinel

Sadly, glibc does not seem to provide an ARRAY_SIZE macro for global use.

-- 
Florian Weimer / Red Hat Product Security


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]