Skip to content

Commit 5abd040

Browse files
author
J. Duke
committed
Merge
2 parents 230cbd7 + d6bac85 commit 5abd040

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1421
-203
lines changed

.hgtags-top-repo

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,3 +963,4 @@ d43cf567cf721406472abc52d12980a25b886577 jdk8u212-b04
963963
8f29b4acc5d2ee4131b1f13d8c3e57be3dcc63a9 jdk8u222-b05
964964
f0f617923cebf0b6dfc1c4cd61467fea847b028d jdk8u222-b06
965965
f321c0bb9fb3124dc35c98d5114c1a8cf4b3d498 jdk8u222-b07
966+
945f4ae40e436792154bfa77336e1d466606ae00 jdk8u222-b08

corba/.hgtags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,3 +1036,4 @@ b6ed07cab3f88f5ff1c18ff26d27644102b6d63c jdk8u212-ga
10361036
5837b825d94bd4fbc1bff28099810e8bcb1e848a jdk8u222-b05
10371037
74bdd387f873523cae121fa48056fb662e289679 jdk8u222-b06
10381038
3abf299d26c40608af206c3b43c35b7ab2aade07 jdk8u222-b07
1039+
d8e58175603e92f46baa775c878cf346181cafed jdk8u222-b08

hotspot/.hgtags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,3 +1269,4 @@ d690709cc3398f8cfd6ffebb89a229105fb3e69a jdk8u222-b04
12691269
1ec20e8a3d8a7a29e9113b14567abec9f0240e9d jdk8u222-b05
12701270
17778f8991c83d794897f05210dce2d2a7b4eb2d jdk8u222-b06
12711271
75f4e02f1113bc353fc60df7330dd5456efc49a3 jdk8u222-b07
1272+
36a743eee6721b423b7c21a3ba28ac8d906a5386 jdk8u222-b08

hotspot/src/share/vm/classfile/vmSymbols.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -832,21 +832,21 @@
832832
do_class(com_sun_crypto_provider_aescrypt, "com/sun/crypto/provider/AESCrypt") \
833833
do_intrinsic(_aescrypt_encryptBlock, com_sun_crypto_provider_aescrypt, encryptBlock_name, byteArray_int_byteArray_int_signature, F_R) \
834834
do_intrinsic(_aescrypt_decryptBlock, com_sun_crypto_provider_aescrypt, decryptBlock_name, byteArray_int_byteArray_int_signature, F_R) \
835-
do_name( encryptBlock_name, "encryptBlock") \
836-
do_name( decryptBlock_name, "decryptBlock") \
835+
do_name( encryptBlock_name, "implEncryptBlock") \
836+
do_name( decryptBlock_name, "implDecryptBlock") \
837837
do_signature(byteArray_int_byteArray_int_signature, "([BI[BI)V") \
838838
\
839839
do_class(com_sun_crypto_provider_cipherBlockChaining, "com/sun/crypto/provider/CipherBlockChaining") \
840840
do_intrinsic(_cipherBlockChaining_encryptAESCrypt, com_sun_crypto_provider_cipherBlockChaining, encrypt_name, byteArray_int_int_byteArray_int_signature, F_R) \
841841
do_intrinsic(_cipherBlockChaining_decryptAESCrypt, com_sun_crypto_provider_cipherBlockChaining, decrypt_name, byteArray_int_int_byteArray_int_signature, F_R) \
842-
do_name( encrypt_name, "encrypt") \
843-
do_name( decrypt_name, "decrypt") \
842+
do_name( encrypt_name, "implEncrypt") \
843+
do_name( decrypt_name, "implDecrypt") \
844844
do_signature(byteArray_int_int_byteArray_int_signature, "([BII[BI)I") \
845845
\
846846
/* support for sun.security.provider.SHA */ \
847847
do_class(sun_security_provider_sha, "sun/security/provider/SHA") \
848848
do_intrinsic(_sha_implCompress, sun_security_provider_sha, implCompress_name, implCompress_signature, F_R) \
849-
do_name( implCompress_name, "implCompress") \
849+
do_name( implCompress_name, "implCompress0") \
850850
do_signature(implCompress_signature, "([BI)V") \
851851
\
852852
/* support for sun.security.provider.SHA2 */ \
@@ -860,7 +860,7 @@
860860
/* support for sun.security.provider.DigestBase */ \
861861
do_class(sun_security_provider_digestbase, "sun/security/provider/DigestBase") \
862862
do_intrinsic(_digestBase_implCompressMB, sun_security_provider_digestbase, implCompressMB_name, implCompressMB_signature, F_R) \
863-
do_name( implCompressMB_name, "implCompressMultiBlock") \
863+
do_name( implCompressMB_name, "implCompressMultiBlock0") \
864864
do_signature(implCompressMB_signature, "([BII)I") \
865865
\
866866
/* support for java.util.zip */ \

jaxp/.hgtags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,3 +1000,4 @@ e0ba0b931da8259728a6a14366734b3f1fcb40bc jdk8u222-b02
10001000
de624afa6e750486bc1ea3e59bf9fb7de24b1379 jdk8u222-b05
10011001
e18fe3687a512b39b08d7d8e288b06cfd7e18840 jdk8u222-b06
10021002
08cd0a82185d3aaa614d628977e1809d6b4879cf jdk8u222-b07
1003+
2b416473fe205b3abea19b8de53d948fbe4f67f1 jdk8u222-b08

jaxws/.hgtags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,3 +994,4 @@ b57a4deb3aca5d6b2d39e6fe6bbe83fdede74f7f jdk8u222-b02
994994
bd5323b37905fc22dc5cddd32384ad9e46feca6e jdk8u222-b05
995995
dfe2ef52003ccd228f05d3d8e18f26eafda88ae1 jdk8u222-b06
996996
2fa997404a5c0ef884a6eb86ca3df2fbc3346fc0 jdk8u222-b07
997+
3a9307bd93d3ed04e7ddf94e46ae6fd349cd8060 jdk8u222-b08

jdk/.hgtags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,3 +995,4 @@ e880f2d161bf23a09f8c1a19861d7df7d2ed126f jdk8u222-b01
995995
887c8314411dd461ec4b1e14cd6368ed3d9a7a3b jdk8u222-b05
996996
63b345c88831be5a690b857adfa84bd20ad376e1 jdk8u222-b06
997997
c7a97c9b7e5932d651eda37c8a907311818491d7 jdk8u222-b07
998+
0bb89d93d4d7da64d408a9888df21085e7bfb291 jdk8u222-b08

jdk/src/macosx/native/java/util/SCDynamicStoreConfig.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -102,7 +102,8 @@ - (id) coerceJavaObject:(jobject)obj withEnv:(JNIEnv *)env usingCoercer:(JNFType
102102
for (NSString *realm in realms) {
103103
CFTypeRef realmInfo = SCDynamicStoreCopyValue(store, (CFStringRef) [NSString stringWithFormat:@"Kerberos:%@", realm]);
104104

105-
if (CFGetTypeID(realmInfo) != CFDictionaryGetTypeID()) {
105+
if (realmInfo == NULL || CFGetTypeID(realmInfo) != CFDictionaryGetTypeID()) {
106+
if (realmInfo) CFRelease(realmInfo);
106107
return nil;
107108
}
108109

jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -184,7 +184,7 @@ BOOL isSWTRunning() {
184184

185185
splash->maskRequired = 0;
186186

187-
187+
188188
//TODO: the following is too much of a hack but should work in 90% cases.
189189
// besides we don't use device-dependant drawing, so probably
190190
// that's very fine indeed
@@ -251,9 +251,11 @@ BOOL isSWTRunning() {
251251
SplashRedrawWindow(Splash * splash) {
252252
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
253253

254-
SplashUpdateScreenData(splash);
255-
256254
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
255+
// drop the reference to the old view and image
256+
[splash->window setContentView: nil];
257+
SplashUpdateScreenData(splash);
258+
257259
// NSDeviceRGBColorSpace vs. NSCalibratedRGBColorSpace ?
258260
NSBitmapImageRep * rep = [[NSBitmapImageRep alloc]
259261
initWithBitmapDataPlanes: (unsigned char**)&splash->screenData
@@ -281,7 +283,7 @@ BOOL isSWTRunning() {
281283
size.height /= scaleFactor;
282284
[image setSize: size];
283285
}
284-
286+
285287
NSImageView * view = [[NSImageView alloc] init];
286288

287289
[view setImage: image];

jdk/src/share/classes/com/sun/crypto/provider/AESCrypt.java

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -346,7 +346,15 @@ static final boolean isKeySizeValid(int len) {
346346
* Encrypt exactly one block of plaintext.
347347
*/
348348
void encryptBlock(byte[] in, int inOffset,
349-
byte[] out, int outOffset)
349+
byte[] out, int outOffset) {
350+
// Array bound checks are done in caller code, i.e.
351+
// FeedbackCipher.encrypt/decrypt(...) to improve performance.
352+
implEncryptBlock(in, inOffset, out, outOffset);
353+
}
354+
355+
// Encryption operation. Possibly replaced with a compiler intrinsic.
356+
private void implEncryptBlock(byte[] in, int inOffset,
357+
byte[] out, int outOffset)
350358
{
351359
int keyOffset = 0;
352360
int t0 = ((in[inOffset++] ) << 24 |
@@ -412,12 +420,19 @@ void encryptBlock(byte[] in, int inOffset,
412420
out[outOffset ] = (byte)(S[(t2 ) & 0xFF] ^ (tt ));
413421
}
414422

415-
416423
/**
417424
* Decrypt exactly one block of plaintext.
418425
*/
419426
void decryptBlock(byte[] in, int inOffset,
420-
byte[] out, int outOffset)
427+
byte[] out, int outOffset) {
428+
// Array bound checks are done in caller code, i.e.
429+
// FeedbackCipher.encrypt/decrypt(...) to improve performance.
430+
implDecryptBlock(in, inOffset, out, outOffset);
431+
}
432+
433+
// Decrypt operation. Possibly replaced with a compiler intrinsic.
434+
private void implDecryptBlock(byte[] in, int inOffset,
435+
byte[] out, int outOffset)
421436
{
422437
int keyOffset = 4;
423438
int t0 = ((in[inOffset++] ) << 24 |
@@ -572,7 +587,6 @@ void decryptBlock(byte[] in, int inOffset,
572587
out[outOffset ] = (byte)(Si[(a0 ) & 0xFF] ^ (t1 ));
573588
}
574589

575-
576590
/**
577591
* Expand a user-supplied key material into a session key.
578592
*

jdk/src/share/classes/com/sun/crypto/provider/CipherBlockChaining.java

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,9 @@
2727

2828
import java.security.InvalidKeyException;
2929
import java.security.ProviderException;
30+
import java.util.Objects;
3031

32+
import sun.security.util.ArrayUtil;
3133

3234
/**
3335
* This class represents ciphers in cipher block chaining (CBC) mode.
@@ -138,18 +140,24 @@ void restore() {
138140
* @return the length of the encrypted data
139141
*/
140142
int encrypt(byte[] plain, int plainOffset, int plainLen,
141-
byte[] cipher, int cipherOffset)
142-
{
143+
byte[] cipher, int cipherOffset) {
143144
if (plainLen <= 0) {
144145
return plainLen;
145146
}
146-
if ((plainLen % blockSize) != 0) {
147-
throw new ProviderException("Internal error in input buffering");
148-
}
147+
ArrayUtil.blockSizeCheck(plainLen, blockSize);
148+
ArrayUtil.nullAndBoundsCheck(plain, plainOffset, plainLen);
149+
ArrayUtil.nullAndBoundsCheck(cipher, cipherOffset, plainLen);
150+
return implEncrypt(plain, plainOffset, plainLen,
151+
cipher, cipherOffset);
152+
}
153+
154+
private int implEncrypt(byte[] plain, int plainOffset, int plainLen,
155+
byte[] cipher, int cipherOffset)
156+
{
149157
int endIndex = plainOffset + plainLen;
150158

151159
for (; plainOffset < endIndex;
152-
plainOffset+=blockSize, cipherOffset += blockSize) {
160+
plainOffset += blockSize, cipherOffset += blockSize) {
153161
for (int i = 0; i < blockSize; i++) {
154162
k[i] = (byte)(plain[i + plainOffset] ^ r[i]);
155163
}
@@ -182,14 +190,19 @@ int encrypt(byte[] plain, int plainOffset, int plainLen,
182190
* @return the length of the decrypted data
183191
*/
184192
int decrypt(byte[] cipher, int cipherOffset, int cipherLen,
185-
byte[] plain, int plainOffset)
186-
{
193+
byte[] plain, int plainOffset) {
187194
if (cipherLen <= 0) {
188195
return cipherLen;
189196
}
190-
if ((cipherLen % blockSize) != 0) {
191-
throw new ProviderException("Internal error in input buffering");
192-
}
197+
ArrayUtil.blockSizeCheck(cipherLen, blockSize);
198+
ArrayUtil.nullAndBoundsCheck(cipher, cipherOffset, cipherLen);
199+
ArrayUtil.nullAndBoundsCheck(plain, plainOffset, cipherLen);
200+
return implDecrypt(cipher, cipherOffset, cipherLen, plain, plainOffset);
201+
}
202+
203+
private int implDecrypt(byte[] cipher, int cipherOffset, int cipherLen,
204+
byte[] plain, int plainOffset)
205+
{
193206
int endIndex = cipherOffset + cipherLen;
194207

195208
for (; cipherOffset < endIndex;

jdk/src/share/classes/com/sun/crypto/provider/CipherFeedback.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
2727

2828
import java.security.InvalidKeyException;
2929
import java.security.ProviderException;
30+
import sun.security.util.ArrayUtil;
3031

3132
/**
3233
* This class represents ciphers in cipher-feedback (CFB) mode.
@@ -149,9 +150,9 @@ void restore() {
149150
*/
150151
int encrypt(byte[] plain, int plainOffset, int plainLen,
151152
byte[] cipher, int cipherOffset) {
152-
if ((plainLen % numBytes) != 0) {
153-
throw new ProviderException("Internal error in input buffering");
154-
}
153+
ArrayUtil.blockSizeCheck(plainLen, numBytes);
154+
ArrayUtil.nullAndBoundsCheck(plain, plainOffset, plainLen);
155+
ArrayUtil.nullAndBoundsCheck(cipher, cipherOffset, plainLen);
155156

156157
int nShift = blockSize - numBytes;
157158
int loopCount = plainLen / numBytes;
@@ -225,9 +226,10 @@ int encryptFinal(byte[] plain, int plainOffset, int plainLen,
225226
*/
226227
int decrypt(byte[] cipher, int cipherOffset, int cipherLen,
227228
byte[] plain, int plainOffset) {
228-
if ((cipherLen % numBytes) != 0) {
229-
throw new ProviderException("Internal error in input buffering");
230-
}
229+
230+
ArrayUtil.blockSizeCheck(cipherLen, numBytes);
231+
ArrayUtil.nullAndBoundsCheck(cipher, cipherOffset, cipherLen);
232+
ArrayUtil.nullAndBoundsCheck(plain, plainOffset, cipherLen);
231233

232234
int nShift = blockSize - numBytes;
233235
int loopCount = cipherLen / numBytes;

jdk/src/share/classes/com/sun/crypto/provider/CounterMode.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
2727

2828
import java.security.InvalidKeyException;
2929

30+
import sun.security.util.ArrayUtil;
3031

3132
/**
3233
* This class represents ciphers in counter (CTR) mode.
@@ -173,6 +174,10 @@ private int crypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
173174
if (len == 0) {
174175
return 0;
175176
}
177+
178+
ArrayUtil.nullAndBoundsCheck(in, inOff, len);
179+
ArrayUtil.nullAndBoundsCheck(out, outOff, len);
180+
176181
int result = len;
177182
while (len-- > 0) {
178183
if (used >= blockSize) {

jdk/src/share/classes/com/sun/crypto/provider/ElectronicCodeBook.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
2727

2828
import java.security.InvalidKeyException;
2929
import java.security.ProviderException;
30+
import sun.security.util.ArrayUtil;
3031

3132
/**
3233
* This class represents ciphers in electronic codebook (ECB) mode.
@@ -112,9 +113,10 @@ void init(boolean decrypting, String algorithm, byte[] key, byte[] iv)
112113
* @return the length of the encrypted data
113114
*/
114115
int encrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
115-
if ((len % blockSize) != 0) {
116-
throw new ProviderException("Internal error in input buffering");
117-
}
116+
ArrayUtil.blockSizeCheck(len, blockSize);
117+
ArrayUtil.nullAndBoundsCheck(in, inOff, len);
118+
ArrayUtil.nullAndBoundsCheck(out, outOff, len);
119+
118120
for (int i = len; i >= blockSize; i -= blockSize) {
119121
embeddedCipher.encryptBlock(in, inOff, out, outOff);
120122
inOff += blockSize;
@@ -141,9 +143,10 @@ int encrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
141143
* @return the length of the decrypted data
142144
*/
143145
int decrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
144-
if ((len % blockSize) != 0) {
145-
throw new ProviderException("Internal error in input buffering");
146-
}
146+
ArrayUtil.blockSizeCheck(len, blockSize);
147+
ArrayUtil.nullAndBoundsCheck(in, inOff, len);
148+
ArrayUtil.nullAndBoundsCheck(out, outOff, len);
149+
147150
for (int i = len; i >= blockSize; i -= blockSize) {
148151
embeddedCipher.decryptBlock(in, inOff, out, outOff);
149152
inOff += blockSize;

0 commit comments

Comments
 (0)