This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] resolv: Allow new "timeout-ms" option
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:
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.