You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by bu...@apache.org on 2002/06/24 20:10:17 UTC
DO NOT REPLY [Bug 10188] New: -
Base64::encode bug handling last quartet
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10188>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10188
Base64::encode bug handling last quartet
Summary: Base64::encode bug handling last quartet
Product: Xerces-C++
Version: 1.7.0
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: Other
Component: Utilities
AssignedTo: xerces-c-dev@xml.apache.org
ReportedBy: ewittmann@scopeware.com
The else clause on line 209 of Base64.cpp needs the following line:
encodedData[ outputIndex++ ] = base64Alphabet[ b2 ];
The reason is that when the last quartet has only 1 byte to encode, b2 (which
has the last 2 bits) is never encoded. The result is a 3 character quartet
instead of a 4 character quartet.
To test, simply pass Base64::encode a buffer with inputLength==1 - the output
will be only 3 characters, two of which are padding '='.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org