Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 34306 invoked from network); 25 Jan 2005 01:26:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 25 Jan 2005 01:26:31 -0000 Received: (qmail 87821 invoked by uid 500); 25 Jan 2005 01:26:24 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 87672 invoked by uid 500); 25 Jan 2005 01:26:23 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 87595 invoked by uid 99); 25 Jan 2005 01:26:23 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO,HTML_40_50,HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from host130.irise.com (HELO irlaex01.ircorp.com) (208.253.241.130) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 24 Jan 2005 17:26:22 -0800 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_NextPart_001_01C5027D.0E45C22D" Subject: RE: codec : Bas64.isArrayByteBase64() issue Date: Mon, 24 Jan 2005 17:27:02 -0800 Message-ID: <3ECA99B6EB4C7F43BBA308CAA4261D9558FA78@irlaex01.ircorp.com> X-MS-Has-Attach: yes X-MS-TNEF-Correlator: Thread-Topic: codec : Bas64.isArrayByteBase64() issue Thread-Index: AcUCfGFZBtwtPEN5Sy6lGJpLufcd2QAAJeoH From: "Ezra Epstein" To: X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N ------_=_NextPart_001_01C5027D.0E45C22D Content-Type: multipart/alternative; boundary="----_=_NextPart_002_01C5027D.0E45C22D" ------_=_NextPart_002_01C5027D.0E45C22D Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Oooops. Wrong patch file. Correct one is attached. =20 =3D Ezra E. ________________________________ From: Ezra Epstein [mailto:eepstein@irise.com] Sent: Mon 1/24/2005 5:22 PM To: commons-dev@jakarta.apache.org Subject: codec : Bas64.isArrayByteBase64() issue There seem to be 2 issues.=20 1. Only 255 byte values are used when creating base64Alphabet, but there = are 256 possible values=20 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 =3D Ezra E. P.S., I can provide a jUnit TestCase if that's useful. =20 ------_=_NextPart_002_01C5027D.0E45C22D Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable =0A= =0A=
=0A=
Oooops.  = Wrong patch =0A= file.  Correct one is attached.
=0A=
 
=0A=
=3D Ezra E.
=0A=

=0A=
=0A= From: Ezra Epstein =0A= [mailto:eepstein@irise.com]
Sent: Mon 1/24/2005 5:22 = PM
To: =0A= commons-dev@jakarta.apache.org
Subject: codec : =0A= Bas64.isArrayByteBase64() issue

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

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

=0A=

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

=0A=

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

=0A=

=3D Ezra E.

=0A=

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

=0A=

 

------_=_NextPart_002_01C5027D.0E45C22D-- ------_=_NextPart_001_01C5027D.0E45C22D Content-Type: text/plain; name="Base64.patch" Content-Transfer-Encoding: base64 Content-Description: Base64.patch Content-Disposition: attachment; filename="Base64.patch" LS0tIEJhc2U2NC5qYXZhLmN2cy4xLjIzCTIwMDUtMDEtMjQgMTY6NTk6NDYuMjExOTM5MjAwIC0w ODAwDQorKysgQmFzZTY0LmphdmEuY2hhbmdlZAkyMDA1LTAxLTI0IDE3OjAzOjQyLjc4MjExMDQw MCAtMDgwMA0KQEAgLTU1LDcgKzU1LDcgQEANCiAgICAgLyoqDQogICAgICAqIFRoZSBiYXNlIGxl bmd0aC4NCiAgICAgICovDQotICAgIHN0YXRpYyBmaW5hbCBpbnQgQkFTRUxFTkdUSCA9IDI1NTsN CisgICAgc3RhdGljIGZpbmFsIGludCBCQVNFTEVOR1RIID0gMjU2Ow0KIA0KICAgICAvKioNCiAg ICAgICogTG9va3VwIGxlbmd0aC4NCkBAIC0xNjIsNyArMTYyLDcgQEANCiAgICAgcHJpdmF0ZSBz dGF0aWMgYm9vbGVhbiBpc0Jhc2U2NChieXRlIG9jdGVjdCkgew0KICAgICAgICAgaWYgKG9jdGVj dCA9PSBQQUQpIHsNCiAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsNCi0gICAgICAgIH0gZWxzZSBp ZiAob2N0ZWN0IDwgMCB8fCBiYXNlNjRBbHBoYWJldFtvY3RlY3RdID09IC0xKSB7DQorICAgICAg ICB9IGVsc2UgaWYgKG9jdGVjdCA8IDAgfHwgYmFzZTY0QWxwaGFiZXRbKG9jdGVjdCA8IDApID8g MjU2ICsgb2N0ZWN0IDogb2N0ZWN0XSA9PSAtMSkgew0KICAgICAgICAgICAgIHJldHVybiBmYWxz ZTsNCiAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgcmV0dXJuIHRydWU7DQpAQCAtNDgy LDYgKzQ4Miw5IEBADQogICAgICAgICAgICAgfQ0KICAgICAgICAgfQ0KIA0KKwkvLyBDaGVjayBp ZiB3ZSdyZSBkb25lIGFuZCBzYXZlIHJlc291cmNlcyBpZiB3ZSBhcmUuDQorCWlmIChieXRlc0Nv cGllZCA9PSBkYXRhLmxlbmd0aCkgcmV0dXJuIGdyb29tZWREYXRhOw0KKwkNCiAgICAgICAgIGJ5 dGUgcGFja2VkRGF0YVtdID0gbmV3IGJ5dGVbYnl0ZXNDb3BpZWRdOw0KIA0KICAgICAgICAgU3lz dGVtLmFycmF5Y29weShncm9vbWVkRGF0YSwgMCwgcGFja2VkRGF0YSwgMCwgYnl0ZXNDb3BpZWQp Ow0K ------_=_NextPart_001_01C5027D.0E45C22D Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org ------_=_NextPart_001_01C5027D.0E45C22D--