[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Error While Checking out Git Repository

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Thu, 09 Feb 2012 18:08:03 +0000

Peter Samuelson <peter_at_p12n.org> writes:

> [Philip Martin]
>> --- ../src/subversion/libsvn_subr/svn_base64.c (revision 1242045)
>> +++ ../src/subversion/libsvn_subr/svn_base64.c (working copy)
>> @@ -410,7 +410,7 @@
>> /* Resize the stringbuf to make room for the (approximate) size of
>> output, to avoid repeated resizes later.
>> The optimizations in decode_line rely on no resizes being necessary! */
>> - svn_stringbuf_ensure(str, str->len + (len / 4) * 3 + 3);
>> + svn_stringbuf_ensure(str, str->len + (len / 4) * 3 + 4);
>>
>> while ( !*done && p < end )
>> {
>>
>> but I don't really understand the comment. There doesn't seem to be
>> anything "approximate" about this calculation?
>
> It is approximate because the encoded length is always a multiple of 4,
> even if the input length was not a multiple of 3. (This is why so many
> base64 strings end in = or ==; those are padding to a 4-byte output
> group.) The decoder doesn't yet know if the final group of 4 bytes
> will decode to 1, 2 or 3 bytes of plaintext.

I believe approximate is still wrong. It's supposed to be an accurate
calculation of the maximum output length. If some approximate value is
used and the output is longer than that then the code will crash.

-- 
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com
Received on 2012-02-09 19:08:42 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.