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] resolv: Allow new "timeout-ms" option


On Thu, Jun 21, 2012 at 6:10 PM, Paul Eggert <eggert@cs.ucla.edu> wrote:
> On 06/21/2012 10:57 AM, Paul Stewart wrote:
>> Is it really the user
>> specified value? ?Under certain circumastances the value we check
>> "<=0" is actually (statp->retrans << ns) / statp->nscount. ?Because I
>> couldn't guarantee under what conditions this value would be zero
>
> If I understand you correctly, are you worried that
> the << could overflow, so that the expression yields
> garbage that might be negative or zero? ?Yes, that's a problem:

You can also get zero if ns and statp->retrans is small and
statp->nscount is large.  I haven't looked hard enough to tell if that
is plausible.

> both the old code and the new misbehave when given large
> time values. ?I'd guess overflow is more plausible if we're
> counting microseconds rather than counting seconds, so it
> might be worth fixing the overflow bugs while you're at it.
> This wouldn't mean you'd have to do multiprecision arithmetic
> or anything fancy; you can just detect the overflow and treat the
> result as infinity, or something like that.


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