Bug 54460

Summary: Base64Converter not properly handling bytes with MSB set (not masking byte to int conversion)
Product: Ant Reporter: Clive Brettingham-Moore <apache-bugzilla>
Component: CoreAssignee: Ant Notifications List <notifications>
Status: RESOLVED FIXED    
Severity: normal CC: jglick
Priority: P2 Keywords: PatchAvailable
Version: 1.8.4   
Target Milestone: 1.9.0   
Hardware: All   
OS: All   
Attachments: svn diff against trunk.

Description Clive Brettingham-Moore 2013-01-22 01:41:04 UTC
Created attachment 29875 [details]
svn diff against trunk.

Base64Converter not properly bytes with MSB set (not masking byte to int conversion).

Every 3rd byte taken for conversion (least significant in triplet is not being masked with added to integer, if the msb is set this leads to a signed extension which overwrites the previous two bytes with all ones.

bits24 |= octetString[i++];

Should be:
bits24 |= octetString[i++] & BYTE_MASK;
Comment 1 Antoine Levy-Lambert 2013-01-23 04:17:27 UTC
Thanks for the report and the patch, now submitted in subversion revision 1437268.