Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 83103 invoked from network); 24 Aug 2006 10:15:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 24 Aug 2006 10:15:32 -0000 Received: (qmail 56416 invoked by uid 500); 24 Aug 2006 10:15:31 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 56386 invoked by uid 500); 24 Aug 2006 10:15:31 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 56368 invoked by uid 99); 24 Aug 2006 10:15:30 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Aug 2006 03:15:30 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Aug 2006 03:15:30 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id D68531A981A; Thu, 24 Aug 2006 03:15:09 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r434367 - in /incubator/harmony/enhanced/classlib/trunk/modules/nio/src: main/java/java/nio/CharSequenceAdapter.java main/java/java/nio/ShortArrayBuffer.java test/java/common/org/apache/harmony/tests/java/nio/ShortBufferTest.java Date: Thu, 24 Aug 2006 10:15:08 -0000 To: harmony-commits@incubator.apache.org From: pyang@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060824101509.D68531A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: pyang Date: Thu Aug 24 03:15:03 2006 New Revision: 434367 URL: http://svn.apache.org/viewvc?rev=434367&view=rev Log: Fix yet another two bugs on array index checking Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/CharSequenceAdapter.java incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ShortArrayBuffer.java incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/tests/java/nio/ShortBufferTest.java Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/CharSequenceAdapter.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/CharSequenceAdapter.java?rev=434367&r1=434366&r2=434367&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/CharSequenceAdapter.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/CharSequenceAdapter.java Thu Aug 24 03:15:03 2006 @@ -117,7 +117,7 @@ } public final CharBuffer put(char[] src, int off, int len) { - if ((off < 0 ) || (len < 0) || off + len > src.length) { + if ((off < 0 ) || (len < 0) || (long)off + (long)len > src.length) { throw new IndexOutOfBoundsException(); } Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ShortArrayBuffer.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ShortArrayBuffer.java?rev=434367&r1=434366&r2=434367&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ShortArrayBuffer.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ShortArrayBuffer.java Thu Aug 24 03:15:03 2006 @@ -65,7 +65,7 @@ public final ShortBuffer get(short[] dest, int off, int len) { int length = dest.length; - if (off < 0 || len < 0 || off + len > length) { + if (off < 0 || len < 0 || (long)off + (long)len > length) { throw new IndexOutOfBoundsException(); } if (len > remaining()) { Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/tests/java/nio/ShortBufferTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/tests/java/nio/ShortBufferTest.java?rev=434367&r1=434366&r2=434367&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/tests/java/nio/ShortBufferTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/tests/java/nio/ShortBufferTest.java Thu Aug 24 03:15:03 2006 @@ -296,13 +296,25 @@ } assertEquals(buf.position(), 0); try { - buf.get(array, 2, -1); + buf.get((short[])null, 2, -1); fail("Should throw Exception"); //$NON-NLS-1$ - } catch (IndexOutOfBoundsException e) { + } catch (NullPointerException e) { // expected } try { buf.get(array, 2, array.length); + fail("Should throw Exception"); //$NON-NLS-1$ + } catch (IndexOutOfBoundsException e) { + // expected + } + try { + buf.get(array, 1, Integer.MAX_VALUE); + fail("Should throw Exception"); //$NON-NLS-1$ + } catch (IndexOutOfBoundsException e) { + // expected + } + try { + buf.get(array, Integer.MAX_VALUE, 1); fail("Should throw Exception"); //$NON-NLS-1$ } catch (IndexOutOfBoundsException e) { // expected