You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Ezra Epstein <ee...@irise.com> on 2005/01/25 02:22:48 UTC

codec : Bas64.isArrayByteBase64() issue

There seem to be 2 issues. 

1.	Only 255 byte values are used when creating base64Alphabet, but there are 256 possible values
2.	octect (shouldn't that be octet ?) isn't shifted despite the fact that Java uses unsigned bytes.  It is used unchanged as on offset into an array (zero based).

As a result I can produce test cases that cause isBase64() to throw IndexOutOfBounds exceptions.

While at it, I suggest one line be added to discardWhitespace() that will improve performance under some circumstances (i.e., when there is no whitespace in the input).

Patch file is attached.Patch file is based on latest version in CVS of Base64.java file: 1.23

= Ezra E.

P.S., I can provide a jUnit TestCase if that's useful.