mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8204196: integer cleanup
Reviewed-by: xuelei
This commit is contained in:
parent
f53e04ead9
commit
4e46cc1392
7 changed files with 18 additions and 12 deletions
|
@ -332,7 +332,7 @@ public final class RSACipher extends CipherSpi {
|
|||
if ((inLen == 0) || (in == null)) {
|
||||
return;
|
||||
}
|
||||
if (bufOfs + inLen > buffer.length) {
|
||||
if (inLen > (buffer.length - bufOfs)) {
|
||||
bufOfs = buffer.length + 1;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2739,7 +2739,7 @@ public class Cipher {
|
|||
|
||||
// Input sanity check
|
||||
if ((src == null) || (offset < 0) || (len < 0)
|
||||
|| ((len + offset) > src.length)) {
|
||||
|| len > (src.length - offset)) {
|
||||
throw new IllegalArgumentException("Bad arguments");
|
||||
}
|
||||
|
||||
|
|
|
@ -588,7 +588,7 @@ abstract class DSA extends SignatureSpi {
|
|||
}
|
||||
}
|
||||
protected void engineUpdate(byte[] input, int offset, int len) {
|
||||
if (ofs + len > digestBuffer.length) {
|
||||
if (len > (digestBuffer.length - ofs)) {
|
||||
ofs = Integer.MAX_VALUE;
|
||||
} else {
|
||||
System.arraycopy(input, offset, digestBuffer, ofs, len);
|
||||
|
@ -597,7 +597,7 @@ abstract class DSA extends SignatureSpi {
|
|||
}
|
||||
protected final void engineUpdate(ByteBuffer input) {
|
||||
int inputLen = input.remaining();
|
||||
if (ofs + inputLen > digestBuffer.length) {
|
||||
if (inputLen > (digestBuffer.length - ofs)) {
|
||||
ofs = Integer.MAX_VALUE;
|
||||
} else {
|
||||
input.get(digestBuffer, ofs, inputLen);
|
||||
|
|
|
@ -1039,7 +1039,7 @@ public class AlgorithmId implements Serializable, DerEncoder {
|
|||
* @return the default alg, might be null if unsupported
|
||||
*/
|
||||
public static String getDefaultSigAlgForKey(PrivateKey k) {
|
||||
switch (k.getAlgorithm().toUpperCase(Locale.ROOT)) {
|
||||
switch (k.getAlgorithm().toUpperCase(Locale.ENGLISH)) {
|
||||
case "EC":
|
||||
return ecStrength(KeyUtil.getKeySize(k))
|
||||
+ "withECDSA";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue