harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r431580 - in /incubator/harmony/enhanced/classlib/trunk/modules/crypto/src: main/java/javax/crypto/spec/IvParameterSpec.java test/api/java/org/apache/harmony/crypto/tests/javax/crypto/spec/IvParameterSpecTest.java
Date Tue, 15 Aug 2006 12:14:04 GMT
Author: mloenko
Date: Tue Aug 15 05:14:03 2006
New Revision: 431580

URL: http://svn.apache.org/viewvc?rev=431580&view=rev
Log:
applied patch for HARMONY-1089
[classlib][crypto] unexpected NegativeArraySizeException for javax.crypto.spec.IvParameterSpec(byte[],
int, -1);

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/spec/IvParameterSpec.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/spec/IvParameterSpecTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/spec/IvParameterSpec.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/spec/IvParameterSpec.java?rev=431580&r1=431579&r2=431580&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/spec/IvParameterSpec.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/main/java/javax/crypto/spec/IvParameterSpec.java
Tue Aug 15 05:14:03 2006
@@ -46,7 +46,10 @@
     public IvParameterSpec(byte[] iv, int offset, int len) {
         if ((iv == null) || (iv.length - offset < len)) {
             throw new IllegalArgumentException(
-                    "iv is null or (iv.length - offset < len).");
+                    "iv is null or (iv.length - offset < len)");
+        }
+        if (offset < 0 || len < 0) {
+            throw new ArrayIndexOutOfBoundsException("offset < 0 or len < 0");
         }
         this.iv = new byte[len];
         System.arraycopy(iv, offset, this.iv, 0, len);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/spec/IvParameterSpecTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/spec/IvParameterSpecTest.java?rev=431580&r1=431579&r2=431580&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/spec/IvParameterSpecTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/spec/IvParameterSpecTest.java
Tue Aug 15 05:14:03 2006
@@ -113,6 +113,14 @@
         iv[0] ++;
         assertFalse("The change of input array's content should not cause "
                     + "the change of internal array", iv[0] == ivps.getIV()[0]);
+
+        //Regression for HARMONY-1089
+        try {
+            new IvParameterSpec(new byte[2], 2,  -1);
+            fail("ArrayIndexOutOfBoundsException expected");
+        } catch (ArrayIndexOutOfBoundsException e) {
+            //expected
+        }
     }
 
     public void testGetIV() {



Mime
View raw message