httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Bannert <aa...@clove.org>
Subject Re: cvs commit: httpd-2.0/modules/http http_protocol.c
Date Wed, 29 May 2002 20:28:58 GMT
On Wed, May 29, 2002 at 10:07:46PM +0200, Martin Kraemer wrote:
> On Wed, May 29, 2002 at 02:57:27PM -0000, aaron@apache.org wrote:
> >   Ignore leading zeros when parsing hex value for chunk extensions.
> >    
> >   +    /* Skip leading zeros */
> >   +    while (*b == '0') {
> >   +        ++b;
> >   +    }
> >   +
> >        while (apr_isxdigit(*b) && (chunkbits > 0)) {
> 
> This patch will IMHO not change anything at all. Leading zeros are
> added by the while (apr_isxdigit..) loop by shifting 0 << 4 and adding 0.
> They never produce any overflow condition, no matter how many there are.

Actually, the theory is that we can only handle a known number of 4-bit
hex digits, so we ignore leading zeros before we start counting those
digits. If we use too many digits, we run out of chunkbits and detect
the overflow and return -1. If we use exactly the right amount of
digits, but overflow the sign bit, the result will be <0 (is this
a valid assumption?). So, if the result is negative, it overflowed.

-aaron

Mime
View raw message