Index: modules/crypto/src/main/java/javax/crypto/spec/IvParameterSpec.java =================================================================== --- modules/crypto/src/main/java/javax/crypto/spec/IvParameterSpec.java (revision 429608) +++ modules/crypto/src/main/java/javax/crypto/spec/IvParameterSpec.java (working copy) @@ -44,10 +44,15 @@ * @com.intel.drl.spec_ref */ 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)."); + if (iv == null) { + throw new IllegalArgumentException("No input buffer given"); } + if (offset < 0 || len < 0) { + throw new IndexOutOfBoundsException("Incorrect offset/len parameters"); + } + if ((long)offset + (long)len > iv.length) { + throw new IllegalArgumentException("Input buffer too short"); + } this.iv = new byte[len]; System.arraycopy(iv, offset, this.iv, 0, len); }