mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8171252: Improve exception checking
Reviewed-by: ascarpino, mschoene
This commit is contained in:
parent
ab51d9296c
commit
2473f1cf41
10 changed files with 58 additions and 590 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -140,7 +140,7 @@ public final class DESedeWrapCipher extends CipherSpi {
|
|||
if (decrypting) {
|
||||
result = inputLen - 16; // CHECKSUM_LEN + IV_LEN;
|
||||
} else {
|
||||
result = inputLen + 16;
|
||||
result = Math.addExact(inputLen, 16);
|
||||
}
|
||||
return (result < 0? 0:result);
|
||||
}
|
||||
|
@ -449,11 +449,11 @@ public final class DESedeWrapCipher extends CipherSpi {
|
|||
}
|
||||
|
||||
byte[] cks = getChecksum(keyVal);
|
||||
byte[] in = new byte[keyVal.length + CHECKSUM_LEN];
|
||||
byte[] in = new byte[Math.addExact(keyVal.length, CHECKSUM_LEN)];
|
||||
System.arraycopy(keyVal, 0, in, 0, keyVal.length);
|
||||
System.arraycopy(cks, 0, in, keyVal.length, CHECKSUM_LEN);
|
||||
|
||||
byte[] out = new byte[iv.length + in.length];
|
||||
byte[] out = new byte[Math.addExact(iv.length, in.length)];
|
||||
System.arraycopy(iv, 0, out, 0, iv.length);
|
||||
|
||||
cipher.encrypt(in, 0, in.length, out, iv.length);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue