[Patches] [ python-Patches-1171487 ] Patch for [ 1170331 ] Error in base64.b32decode
SourceForge.net
noreply at sourceforge.net
Thu Jun 9 00:53:59 CEST 2005
Patches item #1171487, was opened at 2005-03-27 14:46
Message generated for change (Comment added) made by akuchling
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1171487&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: Library (Lib)
>Group: Python 2.4
>Status: Closed
>Resolution: Accepted
Priority: 6
Submitted By: logistix (logistix)
>Assigned to: A.M. Kuchling (akuchling)
Summary: Patch for [ 1170331 ] Error in base64.b32decode
Initial Comment:
base64.b32decode didn't decode some things properly.
Seems to have only impacted characters with a value <
32. Attached is a fix and a new test.
----------------------------------------------------------------------
>Comment By: A.M. Kuchling (akuchling)
Date: 2005-06-08 18:53
Message:
Logged In: YES
user_id=11375
Applied; thanks! I also added a test case that would have
caught the bug.
----------------------------------------------------------------------
Comment By: logistix (logistix)
Date: 2005-03-27 16:43
Message:
Logged In: YES
user_id=699438
Updated patch to reflect another fix.
I originally thought the bug was related to cleanup of a
partial quanta. It will trigger on any quanta where the
initial hex value is < 0x10. When this happens part of the
hex code disappears in the initial conversion and is
mistakenly swallowed. The hex function that was originally
used doesn't zero-pad, but the way the bit shifting works,
it doesn't need to when encoding normal alpha-numeric
characters, so it seemed to work correctly.
This will only cause problems if you are using a character
value of < 0x10 in the 0th, 4th, 8th, 12th, etc positions in
the encoded string. Otherwise it'll work properly. Using
"%010x" ensures that you'll get the appropriate zero-padding
if necessary.
Example of more broken code not covered in the original bug:
>>> base64.b32decode(base64.b32encode('\x00aaa'))
'aaa'
Updated patch fixes this case as well.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1171487&group_id=5470
More information about the Patches
mailing list