Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
786ae0dc
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
786ae0dc
编写于
4月 24, 2020
作者:
A
andrew
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
b747d99c
28e821eb
变更
31
隐藏空白更改
内联
并排
Showing
31 changed file
with
318 addition
and
132 deletion
+318
-132
.hgtags
.hgtags
+2
-0
make/CompileLaunchers.gmk
make/CompileLaunchers.gmk
+0
-1
src/share/classes/com/sun/crypto/provider/JceKeyStore.java
src/share/classes/com/sun/crypto/provider/JceKeyStore.java
+25
-3
src/share/classes/com/sun/crypto/provider/KeyProtector.java
src/share/classes/com/sun/crypto/provider/KeyProtector.java
+6
-3
src/share/classes/com/sun/crypto/provider/SealedObjectForKeyProtector.java
.../com/sun/crypto/provider/SealedObjectForKeyProtector.java
+16
-10
src/share/classes/com/sun/net/httpserver/Headers.java
src/share/classes/com/sun/net/httpserver/Headers.java
+32
-2
src/share/classes/java/io/ObjectInputStream.java
src/share/classes/java/io/ObjectInputStream.java
+3
-1
src/share/classes/java/io/ObjectStreamClass.java
src/share/classes/java/io/ObjectStreamClass.java
+15
-1
src/share/classes/java/lang/instrument/package.html
src/share/classes/java/lang/instrument/package.html
+7
-0
src/share/classes/java/lang/invoke/MethodType.java
src/share/classes/java/lang/invoke/MethodType.java
+14
-24
src/share/classes/java/math/MutableBigInteger.java
src/share/classes/java/math/MutableBigInteger.java
+17
-7
src/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template
...hare/classes/java/nio/ByteBufferAs-X-Buffer.java.template
+0
-1
src/share/classes/java/nio/Direct-X-Buffer.java.template
src/share/classes/java/nio/Direct-X-Buffer.java.template
+0
-1
src/share/classes/java/nio/Heap-X-Buffer.java.template
src/share/classes/java/nio/Heap-X-Buffer.java.template
+48
-32
src/share/classes/java/nio/StringCharBuffer.java
src/share/classes/java/nio/StringCharBuffer.java
+6
-3
src/share/classes/java/util/Scanner.java
src/share/classes/java/util/Scanner.java
+11
-11
src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java
...sses/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java
+8
-2
src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java
...org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java
+8
-2
src/share/classes/sun/security/rsa/RSAKeyFactory.java
src/share/classes/sun/security/rsa/RSAKeyFactory.java
+3
-0
src/share/classes/sun/security/ssl/ClientHandshaker.java
src/share/classes/sun/security/ssl/ClientHandshaker.java
+1
-1
src/share/classes/sun/security/ssl/SSLEngineImpl.java
src/share/classes/sun/security/ssl/SSLEngineImpl.java
+1
-1
src/share/classes/sun/security/ssl/SSLSessionImpl.java
src/share/classes/sun/security/ssl/SSLSessionImpl.java
+1
-14
src/share/classes/sun/security/ssl/SSLSocketImpl.java
src/share/classes/sun/security/ssl/SSLSocketImpl.java
+1
-1
src/share/instrument/InvocationAdapter.c
src/share/instrument/InvocationAdapter.c
+22
-0
src/share/native/sun/awt/splashscreen/splashscreen_gfx_impl.c
...share/native/sun/awt/splashscreen/splashscreen_gfx_impl.c
+1
-1
src/share/native/sun/security/ec/impl/mpi.c
src/share/native/sun/security/ec/impl/mpi.c
+6
-3
src/solaris/native/sun/awt/multiVis.c
src/solaris/native/sun/awt/multiVis.c
+2
-2
src/solaris/native/sun/java2d/x11/X11PMBlitLoops.c
src/solaris/native/sun/java2d/x11/X11PMBlitLoops.c
+1
-1
src/solaris/native/sun/java2d/x11/X11TextRenderer_md.c
src/solaris/native/sun/java2d/x11/X11TextRenderer_md.c
+1
-1
src/solaris/native/sun/java2d/x11/XRBackendNative.c
src/solaris/native/sun/java2d/x11/XRBackendNative.c
+3
-3
test/java/math/BigInteger/ModInvTime.java
test/java/math/BigInteger/ModInvTime.java
+57
-0
未找到文件。
.hgtags
浏览文件 @
786ae0dc
...
...
@@ -1030,3 +1030,5 @@ b959971e0a5a609453c3a122755fc987c36f0566 jdk8u262-b00
6f7370a85071d54772615abab532264dba461c51 jdk8u252-b06
2a93ed39a4e92e02bd59a02aac6cd9ed6defd386 jdk8u252-b07
e17fe591a374d25725b077f5e99a87de6eb2ab5b jdk8u252-b08
3ad9fa6a5a13fab2188de93bdaa38c1a7f8f5521 jdk8u252-b09
3ad9fa6a5a13fab2188de93bdaa38c1a7f8f5521 jdk8u252-ga
make/CompileLaunchers.gmk
浏览文件 @
786ae0dc
...
...
@@ -163,7 +163,6 @@ define SetupLauncher
-DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' \
-DPROGNAME='"$1"' $(DPACKAGEPATH) \
$2, \
CFLAGS_linux := -fPIC, \
CFLAGS_solaris := -KPIC -DHAVE_GETHRTIME, \
LDFLAGS := $(LDFLAGS_JDKEXE) \
$(ORIGIN_ARG) \
...
...
src/share/classes/com/sun/crypto/provider/JceKeyStore.java
浏览文件 @
786ae0dc
...
...
@@ -81,6 +81,12 @@ public final class JceKeyStore extends KeyStoreSpi {
private
static
final
class
SecretKeyEntry
{
Date
date
;
// the creation date of this entry
SealedObject
sealedKey
;
// Maximum possible length of sealedKey. Used to detect malicious
// input data. This field is set to the file length of the keystore
// at loading. It is useless when creating a new SecretKeyEntry
// to be store in a keystore.
int
maxLength
;
}
// Trusted certificate
...
...
@@ -136,8 +142,8 @@ public final class JceKeyStore extends KeyStoreSpi {
}
key
=
keyProtector
.
recover
(
encrInfo
);
}
else
{
key
=
keyProtector
.
unseal
(((
SecretKeyEntry
)
entry
).
sealedKey
);
SecretKeyEntry
ske
=
((
SecretKeyEntry
)
entry
);
key
=
keyProtector
.
unseal
(
ske
.
sealedKey
,
ske
.
maxLength
);
}
return
key
;
...
...
@@ -282,6 +288,7 @@ public final class JceKeyStore extends KeyStoreSpi {
// seal and store the key
entry
.
sealedKey
=
keyProtector
.
seal
(
key
);
entry
.
maxLength
=
Integer
.
MAX_VALUE
;
entries
.
put
(
alias
.
toLowerCase
(
Locale
.
ENGLISH
),
entry
);
}
...
...
@@ -691,6 +698,10 @@ public final class JceKeyStore extends KeyStoreSpi {
if
(
stream
==
null
)
return
;
byte
[]
allData
=
IOUtils
.
readAllBytes
(
stream
);
int
fullLength
=
allData
.
length
;
stream
=
new
ByteArrayInputStream
(
allData
);
if
(
password
!=
null
)
{
md
=
getPreKeyedHash
(
password
);
dis
=
new
DataInputStream
(
new
DigestInputStream
(
stream
,
md
));
...
...
@@ -829,10 +840,11 @@ public final class JceKeyStore extends KeyStoreSpi {
AccessController
.
doPrivileged
(
(
PrivilegedAction
<
Void
>)()
->
{
ObjectInputFilter
.
Config
.
setObjectInputFilter
(
ois2
,
new
DeserializationChecker
());
ois2
,
new
DeserializationChecker
(
fullLength
));
return
null
;
});
entry
.
sealedKey
=
(
SealedObject
)
ois
.
readObject
();
entry
.
maxLength
=
fullLength
;
// NOTE: don't close ois here since we are still
// using dis!!!
}
catch
(
ClassNotFoundException
cnfe
)
{
...
...
@@ -909,8 +921,17 @@ public final class JceKeyStore extends KeyStoreSpi {
* deserialized.
*/
private
static
class
DeserializationChecker
implements
ObjectInputFilter
{
private
static
final
int
MAX_NESTED_DEPTH
=
2
;
// Full length of keystore, anything inside a SecretKeyEntry should not
// be bigger. Otherwise, must be illegal.
private
final
int
fullLength
;
public
DeserializationChecker
(
int
fullLength
)
{
this
.
fullLength
=
fullLength
;
}
@Override
public
ObjectInputFilter
.
Status
checkInput
(
ObjectInputFilter
.
FilterInfo
info
)
{
...
...
@@ -919,6 +940,7 @@ public final class JceKeyStore extends KeyStoreSpi {
long
nestedDepth
=
info
.
depth
();
if
((
nestedDepth
==
1
&&
info
.
serialClass
()
!=
SealedObjectForKeyProtector
.
class
)
||
info
.
arrayLength
()
>
fullLength
||
(
nestedDepth
>
MAX_NESTED_DEPTH
&&
info
.
serialClass
()
!=
null
&&
info
.
serialClass
()
!=
Object
.
class
))
{
...
...
src/share/classes/com/sun/crypto/provider/KeyProtector.java
浏览文件 @
786ae0dc
/*
* Copyright (c) 1998, 201
8
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 201
9
, 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
...
...
@@ -352,8 +352,11 @@ final class KeyProtector {
/**
* Unseals the sealed key.
*
* @param maxLength Maximum possible length of so.
* If bigger, must be illegal.
*/
Key
unseal
(
SealedObject
so
)
Key
unseal
(
SealedObject
so
,
int
maxLength
)
throws
NoSuchAlgorithmException
,
UnrecoverableKeyException
{
SecretKey
sKey
=
null
;
try
{
...
...
@@ -388,7 +391,7 @@ final class KeyProtector {
SunJCE
.
getInstance
(),
"PBEWithMD5AndTripleDES"
);
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
sKey
,
params
);
return
soForKeyProtector
.
getKey
(
cipher
);
return
soForKeyProtector
.
getKey
(
cipher
,
maxLength
);
}
catch
(
NoSuchAlgorithmException
ex
)
{
// Note: this catch needed to be here because of the
// later catch of GeneralSecurityException
...
...
src/share/classes/com/sun/crypto/provider/SealedObjectForKeyProtector.java
浏览文件 @
786ae0dc
...
...
@@ -73,7 +73,7 @@ final class SealedObjectForKeyProtector extends SealedObject {
return
params
;
}
final
Key
getKey
(
Cipher
c
)
final
Key
getKey
(
Cipher
c
,
int
maxLength
)
throws
IOException
,
ClassNotFoundException
,
IllegalBlockSizeException
,
BadPaddingException
{
...
...
@@ -82,7 +82,7 @@ final class SealedObjectForKeyProtector extends SealedObject {
AccessController
.
doPrivileged
(
(
PrivilegedAction
<
Void
>)
()
->
{
ObjectInputFilter
.
Config
.
setObjectInputFilter
(
ois
,
DeserializationChecker
.
ONE_FILTER
);
new
DeserializationChecker
(
maxLength
)
);
return
null
;
});
try
{
...
...
@@ -110,7 +110,7 @@ final class SealedObjectForKeyProtector extends SealedObject {
*/
private
static
class
DeserializationChecker
implements
ObjectInputFilter
{
private
static
final
ObjectInputFilter
O
NE
_FILTER
;
private
static
final
ObjectInputFilter
O
WN
_FILTER
;
static
{
String
prop
=
AccessController
.
doPrivileged
(
...
...
@@ -122,26 +122,32 @@ final class SealedObjectForKeyProtector extends SealedObject {
return
Security
.
getProperty
(
KEY_SERIAL_FILTER
);
}
});
ONE_FILTER
=
new
DeserializationChecker
(
prop
==
null
?
null
:
ObjectInputFilter
.
Config
.
createFilter
(
prop
));
OWN_FILTER
=
prop
==
null
?
null
:
ObjectInputFilter
.
Config
.
createFilter
(
prop
);
}
private
final
ObjectInputFilter
base
;
// Maximum possible length of anything inside
private
final
int
maxLength
;
private
DeserializationChecker
(
ObjectInputFilter
base
)
{
this
.
base
=
base
;
private
DeserializationChecker
(
int
maxLength
)
{
this
.
maxLength
=
maxLength
;
}
@Override
public
ObjectInputFilter
.
Status
checkInput
(
ObjectInputFilter
.
FilterInfo
info
)
{
if
(
info
.
arrayLength
()
>
maxLength
)
{
return
Status
.
REJECTED
;
}
if
(
info
.
serialClass
()
==
Object
.
class
)
{
return
Status
.
UNDECIDED
;
}
if
(
base
!=
null
)
{
Status
result
=
base
.
checkInput
(
info
);
if
(
OWN_FILTER
!=
null
)
{
Status
result
=
OWN_FILTER
.
checkInput
(
info
);
if
(
result
!=
Status
.
UNDECIDED
)
{
return
result
;
}
...
...
src/share/classes/com/sun/net/httpserver/Headers.java
浏览文件 @
786ae0dc
...
...
@@ -80,11 +80,14 @@ public class Headers implements Map<String,List<String>> {
char
[]
b
=
key
.
toCharArray
();
if
(
b
[
0
]
>=
'a'
&&
b
[
0
]
<=
'z'
)
{
b
[
0
]
=
(
char
)(
b
[
0
]
-
(
'a'
-
'A'
));
}
}
else
if
(
b
[
0
]
==
'\r'
||
b
[
0
]
==
'\n'
)
throw
new
IllegalArgumentException
(
"illegal character in key"
);
for
(
int
i
=
1
;
i
<
len
;
i
++)
{
if
(
b
[
i
]
>=
'A'
&&
b
[
i
]
<=
'Z'
)
{
b
[
i
]
=
(
char
)
(
b
[
i
]
+
(
'a'
-
'A'
));
}
}
else
if
(
b
[
i
]
==
'\r'
||
b
[
i
]
==
'\n'
)
throw
new
IllegalArgumentException
(
"illegal character in key"
);
}
return
new
String
(
b
);
}
...
...
@@ -126,6 +129,8 @@ public class Headers implements Map<String,List<String>> {
}
public
List
<
String
>
put
(
String
key
,
List
<
String
>
value
)
{
for
(
String
v
:
value
)
checkValue
(
v
);
return
map
.
put
(
normalize
(
key
),
value
);
}
...
...
@@ -137,6 +142,7 @@ public class Headers implements Map<String,List<String>> {
* @param value the header value to add to the header
*/
public
void
add
(
String
key
,
String
value
)
{
checkValue
(
value
);
String
k
=
normalize
(
key
);
List
<
String
>
l
=
map
.
get
(
k
);
if
(
l
==
null
)
{
...
...
@@ -146,6 +152,30 @@ public class Headers implements Map<String,List<String>> {
l
.
add
(
value
);
}
private
static
void
checkValue
(
String
value
)
{
int
len
=
value
.
length
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
char
c
=
value
.
charAt
(
i
);
if
(
c
==
'\r'
)
{
// is allowed if it is followed by \n and a whitespace char
if
(
i
>=
len
-
2
)
{
throw
new
IllegalArgumentException
(
"Illegal CR found in header"
);
}
char
c1
=
value
.
charAt
(
i
+
1
);
char
c2
=
value
.
charAt
(
i
+
2
);
if
(
c1
!=
'\n'
)
{
throw
new
IllegalArgumentException
(
"Illegal char found after CR in header"
);
}
if
(
c2
!=
' '
&&
c2
!=
'\t'
)
{
throw
new
IllegalArgumentException
(
"No whitespace found after CRLF in header"
);
}
i
+=
2
;
}
else
if
(
c
==
'\n'
)
{
throw
new
IllegalArgumentException
(
"Illegal LF found in header"
);
}
}
}
/**
* sets the given value as the sole header value
* for the given key. If the mapping does not
...
...
src/share/classes/java/io/ObjectInputStream.java
浏览文件 @
786ae0dc
/*
* Copyright (c) 1996, 20
18
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 20
20
, 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
...
...
@@ -1798,6 +1798,8 @@ public class ObjectInputStream
break
;
case
TC_REFERENCE:
descriptor
=
(
ObjectStreamClass
)
readHandle
(
unshared
);
// Should only reference initialized class descriptors
descriptor
.
checkInitialized
();
break
;
case
TC_PROXYCLASSDESC:
descriptor
=
readProxyDesc
(
unshared
);
...
...
src/share/classes/java/io/ObjectStreamClass.java
浏览文件 @
786ae0dc
/*
* Copyright (c) 1996, 20
19
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 20
20
, 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
...
...
@@ -863,6 +863,17 @@ public class ObjectStreamClass implements Serializable {
throw
new
InternalError
(
"Unexpected call when not initialized"
);
}
/**
* Throws InvalidClassException if not initialized.
* To be called in cases where an uninitialized class descriptor indicates
* a problem in the serialization stream.
*/
final
void
checkInitialized
()
throws
InvalidClassException
{
if
(!
initialized
)
{
throw
new
InvalidClassException
(
"Class descriptor should be initialized"
);
}
}
/**
* Throws an InvalidClassException if object instances referencing this
* class descriptor should not be allowed to deserialize. This method does
...
...
@@ -1119,6 +1130,9 @@ public class ObjectStreamClass implements Serializable {
}
catch
(
IllegalAccessException
ex
)
{
// should not occur, as access checks have been suppressed
throw
new
InternalError
(
ex
);
}
catch
(
InstantiationError
err
)
{
throw
(
InstantiationException
)
new
InstantiationException
().
initCause
(
err
);
}
}
else
{
throw
new
UnsupportedOperationException
();
...
...
src/share/classes/java/lang/instrument/package.html
浏览文件 @
786ae0dc
...
...
@@ -38,6 +38,13 @@
Provides services that allow Java programming language agents to instrument programs running on the JVM.
The mechanism for instrumentation is modification of the byte-codes of methods.
<P>
Note: developers/admininstrators are responsible for verifying the trustworthiness of
content and structure of the Java Agents they deploy, since those are able to arbitrarily
transform the bytecode from other JAR files. Since that happens after the Jars containing
the bytecode have been verified as trusted, the trustworthiness of a Java Agent can determine
the trust towards the entire program.
<h2>
Package Specification
</h2>
<P>
...
...
src/share/classes/java/lang/invoke/MethodType.java
浏览文件 @
786ae0dc
...
...
@@ -97,7 +97,8 @@ class MethodType implements java.io.Serializable {
// The remaining fields are caches of various sorts:
private
@Stable
MethodTypeForm
form
;
// erased form, plus cached data about primitives
private
@Stable
MethodType
wrapAlt
;
// alternative wrapped/unwrapped version
private
@Stable
Object
wrapAlt
;
// alternative wrapped/unwrapped version and
// private communication for readObject and readResolve
private
@Stable
Invokers
invokers
;
// cache of handy higher-order adapters
private
@Stable
String
methodDescriptor
;
// cache for toMethodDescriptorString
...
...
@@ -673,7 +674,7 @@ class MethodType implements java.io.Serializable {
private
static
MethodType
wrapWithPrims
(
MethodType
pt
)
{
assert
(
pt
.
hasPrimitives
());
MethodType
wt
=
pt
.
wrapAlt
;
MethodType
wt
=
(
MethodType
)
pt
.
wrapAlt
;
if
(
wt
==
null
)
{
// fill in lazily
wt
=
MethodTypeForm
.
canonicalize
(
pt
,
MethodTypeForm
.
WRAP
,
MethodTypeForm
.
WRAP
);
...
...
@@ -685,7 +686,7 @@ class MethodType implements java.io.Serializable {
private
static
MethodType
unwrapWithNoPrims
(
MethodType
wt
)
{
assert
(!
wt
.
hasPrimitives
());
MethodType
uwt
=
wt
.
wrapAlt
;
MethodType
uwt
=
(
MethodType
)
wt
.
wrapAlt
;
if
(
uwt
==
null
)
{
// fill in lazily
uwt
=
MethodTypeForm
.
canonicalize
(
wt
,
MethodTypeForm
.
UNWRAP
,
MethodTypeForm
.
UNWRAP
);
...
...
@@ -1144,27 +1145,18 @@ s.writeObject(this.parameterArray());
* @see #writeObject
*/
private
void
readObject
(
java
.
io
.
ObjectInputStream
s
)
throws
java
.
io
.
IOException
,
ClassNotFoundException
{
// Assign temporary defaults in case this object escapes
MethodType_init
(
void
.
class
,
NO_PTYPES
);
// Assign defaults in case this object escapes
UNSAFE
.
putObject
(
this
,
rtypeOffset
,
void
.
class
);
UNSAFE
.
putObject
(
this
,
ptypesOffset
,
NO_PTYPES
);
s
.
defaultReadObject
();
// requires serialPersistentFields to be an empty array
Class
<?>
returnType
=
(
Class
<?>)
s
.
readObject
();
Class
<?>[]
parameterArray
=
(
Class
<?>[])
s
.
readObject
();
parameterArray
=
parameterArray
.
clone
();
// make sure it is unshared
// Assign deserialized values
MethodType_init
(
returnType
,
parameterArray
);
}
// Initialization of state for deserialization only
private
void
MethodType_init
(
Class
<?>
rtype
,
Class
<?>[]
ptypes
)
{
// In order to communicate these values to readResolve, we must
// store them into the implementation-specific final fields.
checkRtype
(
rtype
);
checkPtypes
(
ptypes
);
UNSAFE
.
putObject
(
this
,
rtypeOffset
,
rtype
);
UNSAFE
.
putObject
(
this
,
ptypesOffset
,
ptypes
);
// Verify all operands, and make sure ptypes is unshared
// Cache the new MethodType for readResolve
wrapAlt
=
new
MethodType
[]{
MethodType
.
methodType
(
returnType
,
parameterArray
)};
}
// Support for resetting final fields while deserializing
...
...
@@ -1189,12 +1181,10 @@ s.writeObject(this.parameterArray());
// Do not use a trusted path for deserialization:
// return makeImpl(rtype, ptypes, true);
// Verify all operands, and make sure ptypes is unshared:
try
{
return
methodType
(
rtype
,
ptypes
);
}
finally
{
// Re-assign defaults in case this object escapes
MethodType_init
(
void
.
class
,
NO_PTYPES
);
}
// Return a new validated MethodType for the rtype and ptypes passed from readObject.
MethodType
mt
=
((
MethodType
[])
wrapAlt
)[
0
];
wrapAlt
=
null
;
return
mt
;
}
/**
...
...
src/share/classes/java/math/MutableBigInteger.java
浏览文件 @
786ae0dc
/*
* Copyright (c) 1999, 20
13
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
20
, 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
...
...
@@ -2088,8 +2088,8 @@ class MutableBigInteger {
}
/**
* Calculate the multiplicative inverse of this mod
mod, where mod is odd.
* This and mod are not changed by the calculation.
* Calculate the multiplicative inverse of this mod
ulo mod, where the mod
*
argument is odd.
This and mod are not changed by the calculation.
*
* This method implements an algorithm due to Richard Schroeppel, that uses
* the same intermediate representation as Montgomery Reduction
...
...
@@ -2143,8 +2143,18 @@ class MutableBigInteger {
k
+=
trailingZeros
;
}
while
(
c
.
sign
<
0
)
c
.
signedAdd
(
p
);
if
(
c
.
compare
(
p
)
>=
0
)
{
// c has a larger magnitude than p
MutableBigInteger
remainder
=
c
.
divide
(
p
,
new
MutableBigInteger
());
// The previous line ignores the sign so we copy the data back
// into c which will restore the sign as needed (and converts
// it back to a SignedMutableBigInteger)
c
.
copyValue
(
remainder
);
}
if
(
c
.
sign
<
0
)
{
c
.
signedAdd
(
p
);
}
return
fixup
(
c
,
p
,
k
);
}
...
...
@@ -2182,8 +2192,8 @@ class MutableBigInteger {
}
// In theory, c may be greater than p at this point (Very rare!)
while
(
c
.
compare
(
p
)
>=
0
)
c
.
subtract
(
p
);
if
(
c
.
compare
(
p
)
>=
0
)
c
=
c
.
divide
(
p
,
new
MutableBigInteger
()
);
return
c
;
}
...
...
src/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template
浏览文件 @
786ae0dc
...
...
@@ -72,7 +72,6 @@ class ByteBufferAs$Type$Buffer$RW$$BO$ // package-private
public
$
Type
$
Buffer
slice
()
{
int
pos
=
this
.
position
();
int
lim
=
this
.
limit
();
assert
(
pos
<=
lim
);
int
rem
=
(
pos
<=
lim
?
lim
-
pos
:
0
);
int
off
=
(
pos
<<
$
LG_BYTES_PER_VALUE
$)
+
offset
;
assert
(
off
>=
0
);
...
...
src/share/classes/java/nio/Direct-X-Buffer.java.template
浏览文件 @
786ae0dc
...
...
@@ -206,7 +206,6 @@ class Direct$Type$Buffer$RW$$BO$
public $Type$Buffer slice() {
int pos = this.position();
int lim = this.limit();
assert (pos <= lim);
int rem = (pos <= lim ? lim - pos : 0);
int off = (pos << $LG_BYTES_PER_VALUE$);
assert (off >= 0);
...
...
src/share/classes/java/nio/Heap-X-Buffer.java.template
浏览文件 @
786ae0dc
...
...
@@ -95,12 +95,15 @@ class Heap$Type$Buffer$RW$
}
public
$
Type
$
Buffer
slice
()
{
int
pos
=
this
.
position
();
int
lim
=
this
.
limit
();
int
rem
=
(
pos
<=
lim
?
lim
-
pos
:
0
);
return
new
Heap
$
Type
$
Buffer
$
RW
$(
hb
,
-
1
,
0
,
this
.
remaining
()
,
this
.
remaining
()
,
this
.
position
()
+
offset
);
rem
,
rem
,
pos
+
offset
);
}
public
$
Type
$
Buffer
duplicate
()
{
...
...
@@ -147,10 +150,11 @@ class Heap$Type$Buffer$RW$
public
$
Type
$
Buffer
get
($
type
$[]
dst
,
int
offset
,
int
length
)
{
checkBounds
(
offset
,
length
,
dst
.
length
);
if
(
length
>
remaining
())
int
pos
=
position
();
if
(
length
>
limit
()
-
pos
)
throw
new
BufferUnderflowException
();
System
.
arraycopy
(
hb
,
ix
(
pos
ition
()
),
dst
,
offset
,
length
);
position
(
pos
ition
()
+
length
);
System
.
arraycopy
(
hb
,
ix
(
pos
),
dst
,
offset
,
length
);
position
(
pos
+
length
);
return
this
;
}
...
...
@@ -185,10 +189,11 @@ class Heap$Type$Buffer$RW$
public
$
Type
$
Buffer
put
($
type
$[]
src
,
int
offset
,
int
length
)
{
#
if
[
rw
]
checkBounds
(
offset
,
length
,
src
.
length
);
if
(
length
>
remaining
())
int
pos
=
position
();
if
(
length
>
limit
()
-
pos
)
throw
new
BufferOverflowException
();
System
.
arraycopy
(
src
,
offset
,
hb
,
ix
(
pos
ition
()
),
length
);
position
(
pos
ition
()
+
length
);
System
.
arraycopy
(
src
,
offset
,
hb
,
ix
(
pos
),
length
);
position
(
pos
+
length
);
return
this
;
#
else
[
rw
]
throw
new
ReadOnlyBufferException
();
...
...
@@ -201,19 +206,22 @@ class Heap$Type$Buffer$RW$
if
(
src
==
this
)
throw
new
IllegalArgumentException
();
Heap
$
Type
$
Buffer
sb
=
(
Heap
$
Type
$
Buffer
)
src
;
int
n
=
sb
.
remaining
();
if
(
n
>
remaining
())
int
pos
=
position
();
int
sbpos
=
sb
.
position
();
int
n
=
sb
.
limit
()
-
sbpos
;
if
(
n
>
limit
()
-
pos
)
throw
new
BufferOverflowException
();
System
.
arraycopy
(
sb
.
hb
,
sb
.
ix
(
sb
.
position
()
),
hb
,
ix
(
pos
ition
()
),
n
);
sb
.
position
(
sb
.
position
()
+
n
);
position
(
pos
ition
()
+
n
);
System
.
arraycopy
(
sb
.
hb
,
sb
.
ix
(
sb
pos
),
hb
,
ix
(
pos
),
n
);
sb
.
position
(
sb
pos
+
n
);
position
(
pos
+
n
);
}
else
if
(
src
.
isDirect
())
{
int
n
=
src
.
remaining
();
if
(
n
>
remaining
())
int
pos
=
position
();
if
(
n
>
limit
()
-
pos
)
throw
new
BufferOverflowException
();
src
.
get
(
hb
,
ix
(
pos
ition
()
),
n
);
position
(
pos
ition
()
+
n
);
src
.
get
(
hb
,
ix
(
pos
),
n
);
position
(
pos
+
n
);
}
else
{
super
.
put
(
src
);
}
...
...
@@ -225,8 +233,10 @@ class Heap$Type$Buffer$RW$
public
$
Type
$
Buffer
compact
()
{
#
if
[
rw
]
System
.
arraycopy
(
hb
,
ix
(
position
()),
hb
,
ix
(
0
),
remaining
());
position
(
remaining
());
int
pos
=
position
();
int
rem
=
limit
()
-
pos
;
System
.
arraycopy
(
hb
,
ix
(
pos
),
hb
,
ix
(
0
),
rem
);
position
(
rem
);
limit
(
capacity
());
discardMark
();
return
this
;
...
...
@@ -284,8 +294,9 @@ class Heap$Type$Buffer$RW$
}
public
CharBuffer
asCharBuffer
()
{
int
size
=
this
.
remaining
()
>>
1
;
int
off
=
offset
+
position
();
int
pos
=
position
();
int
size
=
(
limit
()
-
pos
)
>>
1
;
int
off
=
offset
+
pos
;
return
(
bigEndian
?
(
CharBuffer
)(
new
ByteBufferAsCharBuffer
$
RW
$
B
(
this
,
-
1
,
...
...
@@ -335,8 +346,9 @@ class Heap$Type$Buffer$RW$
}
public
ShortBuffer
asShortBuffer
()
{
int
size
=
this
.
remaining
()
>>
1
;
int
off
=
offset
+
position
();
int
pos
=
position
();
int
size
=
(
limit
()
-
pos
)
>>
1
;
int
off
=
offset
+
pos
;
return
(
bigEndian
?
(
ShortBuffer
)(
new
ByteBufferAsShortBuffer
$
RW
$
B
(
this
,
-
1
,
...
...
@@ -386,8 +398,9 @@ class Heap$Type$Buffer$RW$
}
public
IntBuffer
asIntBuffer
()
{
int
size
=
this
.
remaining
()
>>
2
;
int
off
=
offset
+
position
();
int
pos
=
position
();
int
size
=
(
limit
()
-
pos
)
>>
2
;
int
off
=
offset
+
pos
;
return
(
bigEndian
?
(
IntBuffer
)(
new
ByteBufferAsIntBuffer
$
RW
$
B
(
this
,
-
1
,
...
...
@@ -437,8 +450,9 @@ class Heap$Type$Buffer$RW$
}
public
LongBuffer
asLongBuffer
()
{
int
size
=
this
.
remaining
()
>>
3
;
int
off
=
offset
+
position
();
int
pos
=
position
();
int
size
=
(
limit
()
-
pos
)
>>
3
;
int
off
=
offset
+
pos
;
return
(
bigEndian
?
(
LongBuffer
)(
new
ByteBufferAsLongBuffer
$
RW
$
B
(
this
,
-
1
,
...
...
@@ -488,8 +502,9 @@ class Heap$Type$Buffer$RW$
}
public
FloatBuffer
asFloatBuffer
()
{
int
size
=
this
.
remaining
()
>>
2
;
int
off
=
offset
+
position
();
int
pos
=
position
();
int
size
=
(
limit
()
-
pos
)
>>
2
;
int
off
=
offset
+
pos
;
return
(
bigEndian
?
(
FloatBuffer
)(
new
ByteBufferAsFloatBuffer
$
RW
$
B
(
this
,
-
1
,
...
...
@@ -539,8 +554,9 @@ class Heap$Type$Buffer$RW$
}
public
DoubleBuffer
asDoubleBuffer
()
{
int
size
=
this
.
remaining
()
>>
3
;
int
off
=
offset
+
position
();
int
pos
=
position
();
int
size
=
(
limit
()
-
pos
)
>>
3
;
int
off
=
offset
+
pos
;
return
(
bigEndian
?
(
DoubleBuffer
)(
new
ByteBufferAsDoubleBuffer
$
RW
$
B
(
this
,
-
1
,
...
...
src/share/classes/java/nio/StringCharBuffer.java
浏览文件 @
786ae0dc
...
...
@@ -42,12 +42,15 @@ class StringCharBuffer // package-private
}
public
CharBuffer
slice
()
{
int
pos
=
this
.
position
();
int
lim
=
this
.
limit
();
int
rem
=
(
pos
<=
lim
?
lim
-
pos
:
0
);
return
new
StringCharBuffer
(
str
,
-
1
,
0
,
this
.
remaining
()
,
this
.
remaining
()
,
offset
+
this
.
position
()
);
rem
,
rem
,
offset
+
pos
);
}
private
StringCharBuffer
(
CharSequence
s
,
...
...
src/share/classes/java/util/Scanner.java
浏览文件 @
786ae0dc
/*
* Copyright (c) 2003, 20
13
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
20
, 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
...
...
@@ -425,7 +425,7 @@ public final class Scanner implements Iterator<String>, Closeable {
// here but what can we do? The final authority will be
// whatever parse method is invoked, so ultimately the
// Scanner will do the right thing
String
digit
=
"((?i)["
+
radixDigits
+
"
]|\\p{javaDigit}
)"
;
String
digit
=
"((?i)["
+
radixDigits
+
"
\\p{javaDigit}]
)"
;
String
groupedNumeral
=
"("
+
non0Digit
+
digit
+
"?"
+
digit
+
"?("
+
groupSeparator
+
digit
+
digit
+
digit
+
")+)"
;
// digit++ is the possessive form which is necessary for reducing
...
...
@@ -475,7 +475,7 @@ public final class Scanner implements Iterator<String>, Closeable {
private
Pattern
decimalPattern
;
private
void
buildFloatAndDecimalPattern
()
{
// \\p{javaDigit} may not be perfect, see above
String
digit
=
"(
[0-9]|(\\p{javaDigit}
))"
;
String
digit
=
"(
([0-9\\p{javaDigit}]
))"
;
String
exponent
=
"([eE][+-]?"
+
digit
+
"+)?"
;
String
groupedNumeral
=
"("
+
non0Digit
+
digit
+
"?"
+
digit
+
"?("
+
groupSeparator
+
digit
+
digit
+
digit
+
")+)"
;
...
...
@@ -1188,25 +1188,25 @@ public final class Scanner implements Iterator<String>, Closeable {
// These must be literalized to avoid collision with regex
// metacharacters such as dot or parenthesis
groupSeparator
=
"\\
"
+
dfs
.
getGroupingSeparator
()
;
decimalSeparator
=
"\\
"
+
dfs
.
getDecimalSeparator
()
;
groupSeparator
=
"\\
x{"
+
Integer
.
toHexString
(
dfs
.
getGroupingSeparator
())
+
"}"
;
decimalSeparator
=
"\\
x{"
+
Integer
.
toHexString
(
dfs
.
getDecimalSeparator
())
+
"}"
;
// Quoting the nonzero length locale-specific things
// to avoid potential conflict with metacharacters
nanString
=
"\\Q"
+
dfs
.
getNaN
()
+
"\\E"
;
infinityString
=
"\\Q"
+
dfs
.
getInfinity
()
+
"\\E"
;
nanString
=
Pattern
.
quote
(
dfs
.
getNaN
())
;
infinityString
=
Pattern
.
quote
(
dfs
.
getInfinity
())
;
positivePrefix
=
df
.
getPositivePrefix
();
if
(
positivePrefix
.
length
()
>
0
)
positivePrefix
=
"\\Q"
+
positivePrefix
+
"\\E"
;
positivePrefix
=
Pattern
.
quote
(
positivePrefix
)
;
negativePrefix
=
df
.
getNegativePrefix
();
if
(
negativePrefix
.
length
()
>
0
)
negativePrefix
=
"\\Q"
+
negativePrefix
+
"\\E"
;
negativePrefix
=
Pattern
.
quote
(
negativePrefix
)
;
positiveSuffix
=
df
.
getPositiveSuffix
();
if
(
positiveSuffix
.
length
()
>
0
)
positiveSuffix
=
"\\Q"
+
positiveSuffix
+
"\\E"
;
positiveSuffix
=
Pattern
.
quote
(
positiveSuffix
)
;
negativeSuffix
=
df
.
getNegativeSuffix
();
if
(
negativeSuffix
.
length
()
>
0
)
negativeSuffix
=
"\\Q"
+
negativeSuffix
+
"\\E"
;
negativeSuffix
=
Pattern
.
quote
(
negativeSuffix
)
;
// Force rebuilding and recompilation of locale dependent
// primitive patterns
...
...
src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java
浏览文件 @
786ae0dc
...
...
@@ -153,9 +153,15 @@ public final class DOMKeyInfoFactory extends KeyInfoFactory {
"support DOM Level 2 and be namespace aware"
);
}
if
(
tag
.
equals
(
"KeyInfo"
))
{
return
new
DOMKeyInfo
(
element
,
new
UnmarshalContext
(),
getProvider
());
try
{
return
new
DOMKeyInfo
(
element
,
new
UnmarshalContext
(),
getProvider
());
}
catch
(
MarshalException
me
)
{
throw
me
;
}
catch
(
Exception
e
)
{
throw
new
MarshalException
(
e
);
}
}
else
{
throw
new
MarshalException
(
"
i
nvalid KeyInfo tag: "
+
tag
);
throw
new
MarshalException
(
"
I
nvalid KeyInfo tag: "
+
tag
);
}
}
...
...
src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java
浏览文件 @
786ae0dc
...
...
@@ -190,9 +190,15 @@ public final class DOMXMLSignatureFactory extends XMLSignatureFactory {
"support DOM Level 2 and be namespace aware"
);
}
if
(
tag
.
equals
(
"Signature"
))
{
return
new
DOMXMLSignature
(
element
,
context
,
getProvider
());
try
{
return
new
DOMXMLSignature
(
element
,
context
,
getProvider
());
}
catch
(
MarshalException
me
)
{
throw
me
;
}
catch
(
Exception
e
)
{
throw
new
MarshalException
(
e
);
}
}
else
{
throw
new
MarshalException
(
"
i
nvalid Signature tag: "
+
tag
);
throw
new
MarshalException
(
"
I
nvalid Signature tag: "
+
tag
);
}
}
...
...
src/share/classes/sun/security/rsa/RSAKeyFactory.java
浏览文件 @
786ae0dc
...
...
@@ -115,6 +115,9 @@ public class RSAKeyFactory extends KeyFactorySpi {
* Used by RSASignature and RSACipher.
*/
public
static
RSAKey
toRSAKey
(
Key
key
)
throws
InvalidKeyException
{
if
(
key
==
null
)
{
throw
new
InvalidKeyException
(
"Key must not be null"
);
}
if
((
key
instanceof
RSAPrivateKeyImpl
)
||
(
key
instanceof
RSAPrivateCrtKeyImpl
)
||
(
key
instanceof
RSAPublicKeyImpl
))
{
...
...
src/share/classes/sun/security/ssl/ClientHandshaker.java
浏览文件 @
786ae0dc
...
...
@@ -1337,7 +1337,7 @@ final class ClientHandshaker extends Handshaker {
@Override
HandshakeMessage
getKickstartMessage
()
throws
SSLException
{
// session ID of the ClientHello message
SessionId
sessionId
=
SSLSessionImpl
.
nullSession
.
getSessionId
(
);
SessionId
sessionId
=
new
SessionId
(
new
byte
[
0
]
);
// a list of cipher suites sent by the client
CipherSuiteList
cipherSuites
=
getActiveCipherSuites
();
...
...
src/share/classes/sun/security/ssl/SSLEngineImpl.java
浏览文件 @
786ae0dc
...
...
@@ -375,7 +375,7 @@ final public class SSLEngineImpl extends SSLEngine {
}
sslContext
=
ctx
;
sess
=
SSLSessionImpl
.
nullSession
;
sess
=
new
SSLSessionImpl
()
;
handshakeSession
=
null
;
/*
...
...
src/share/classes/sun/security/ssl/SSLSessionImpl.java
浏览文件 @
786ae0dc
...
...
@@ -73,11 +73,6 @@ import static sun.security.ssl.CipherSuite.KeyExchange.*;
*/
final
class
SSLSessionImpl
extends
ExtendedSSLSession
{
/*
* we only really need a single null session
*/
static
final
SSLSessionImpl
nullSession
=
new
SSLSessionImpl
();
// compression methods
private
static
final
byte
compression_null
=
0
;
...
...
@@ -148,7 +143,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
* be used either by a client or by a server, as a connection is
* first opened and before handshaking begins.
*/
private
SSLSessionImpl
()
{
SSLSessionImpl
()
{
this
(
ProtocolVersion
.
NONE
,
CipherSuite
.
C_NULL
,
null
,
new
SessionId
(
false
,
null
),
null
,
-
1
,
false
,
null
);
}
...
...
@@ -657,14 +652,6 @@ final class SSLSessionImpl extends ExtendedSSLSession {
*/
@Override
synchronized
public
void
invalidate
()
{
//
// Can't invalidate the NULL session -- this would be
// attempted when we get a handshaking error on a brand
// new connection, with no "real" session yet.
//
if
(
this
==
nullSession
)
{
return
;
}
invalidated
=
true
;
if
(
debug
!=
null
&&
Debug
.
isOn
(
"session"
))
{
System
.
out
.
println
(
"%% Invalidated: "
+
this
);
...
...
src/share/classes/sun/security/ssl/SSLSocketImpl.java
浏览文件 @
786ae0dc
...
...
@@ -610,7 +610,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
*/
private
void
init
(
SSLContextImpl
context
,
boolean
isServer
)
{
sslContext
=
context
;
sess
=
SSLSessionImpl
.
nullSession
;
sess
=
new
SSLSessionImpl
()
;
handshakeSession
=
null
;
/*
...
...
src/share/instrument/InvocationAdapter.c
浏览文件 @
786ae0dc
...
...
@@ -203,6 +203,17 @@ Agent_OnLoad(JavaVM *vm, char *tail, void * reserved) {
*/
oldLen
=
(
int
)
strlen
(
premainClass
);
newLen
=
modifiedUtf8LengthOfUtf8
(
premainClass
,
oldLen
);
/*
* According to JVMS class name is represented as CONSTANT_Utf8_info,
* so its length is u2 (i.e. must be <= 0xFFFF).
*/
if
(
newLen
>
0xFFFF
)
{
fprintf
(
stderr
,
"-javaagent: Premain-Class value is too big
\n
"
);
free
(
jarfile
);
if
(
options
!=
NULL
)
free
(
options
);
freeAttributes
(
attributes
);
return
JNI_ERR
;
}
if
(
newLen
==
oldLen
)
{
premainClass
=
strdup
(
premainClass
);
}
else
{
...
...
@@ -362,6 +373,17 @@ Agent_OnAttach(JavaVM* vm, char *args, void * reserved) {
*/
oldLen
=
strlen
(
agentClass
);
newLen
=
modifiedUtf8LengthOfUtf8
(
agentClass
,
oldLen
);
/*
* According to JVMS class name is represented as CONSTANT_Utf8_info,
* so its length is u2 (i.e. must be <= 0xFFFF).
*/
if
(
newLen
>
0xFFFF
)
{
fprintf
(
stderr
,
"Agent-Class value is too big
\n
"
);
free
(
jarfile
);
if
(
options
!=
NULL
)
free
(
options
);
freeAttributes
(
attributes
);
return
AGENT_ERROR_BADJAR
;
}
if
(
newLen
==
oldLen
)
{
agentClass
=
strdup
(
agentClass
);
}
else
{
...
...
src/share/native/sun/awt/splashscreen/splashscreen_gfx_impl.c
浏览文件 @
786ae0dc
...
...
@@ -206,7 +206,7 @@ initRect(ImageRect * pRect, int x, int y, int width, int height, int jump,
int
depthBytes
=
format
->
depthBytes
;
pRect
->
pBits
=
pBits
;
INCPN
(
byte_t
,
pRect
->
pBits
,
y
*
stride
+
x
*
depthBytes
);
INCPN
(
byte_t
,
pRect
->
pBits
,
(
intptr_t
)
y
*
stride
+
x
*
depthBytes
);
pRect
->
numLines
=
height
;
pRect
->
numSamples
=
width
;
pRect
->
stride
=
stride
*
jump
;
...
...
src/share/native/sun/security/ec/impl/mpi.c
浏览文件 @
786ae0dc
/*
* Copyright (c) 2007, 20
14
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 20
20
, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
* This library is free software; you can redistribute it and/or
...
...
@@ -34,7 +34,7 @@
* Netscape Communications Corporation
* Douglas Stebila <douglas@stebila.ca> of Sun Laboratories.
*
* Last Modified Date from the Original Code:
June 2014
* Last Modified Date from the Original Code:
Nov 2019
*********************************************************************** */
/* Arbitrary precision integer arithmetic library */
...
...
@@ -2134,7 +2134,10 @@ mp_err s_mp_almost_inverse(const mp_int *a, const mp_int *p, mp_int *c)
}
}
if
(
res
>=
0
)
{
while
(
MP_SIGN
(
c
)
!=
MP_ZPOS
)
{
if
(
s_mp_cmp
(
c
,
p
)
>=
0
)
{
MP_CHECKOK
(
mp_div
(
c
,
p
,
NULL
,
c
));
}
if
(
MP_SIGN
(
c
)
!=
MP_ZPOS
)
{
MP_CHECKOK
(
mp_add
(
c
,
p
,
c
)
);
}
res
=
k
;
...
...
src/solaris/native/sun/awt/multiVis.c
浏览文件 @
786ae0dc
...
...
@@ -437,9 +437,9 @@ ReadRegionsInList(Display *disp, Visual *fakeVis, int depth, int format,
bytes_per_line
=
ximage
->
bytes_per_line
;
if
(
format
==
ZPixmap
)
ximage
->
data
=
malloc
(
height
*
bytes_per_line
);
ximage
->
data
=
malloc
((
size_t
)
height
*
bytes_per_line
);
else
ximage
->
data
=
malloc
(
height
*
bytes_per_line
*
depth
);
ximage
->
data
=
malloc
(
(
size_t
)
height
*
bytes_per_line
*
depth
);
ximage
->
bits_per_pixel
=
depth
;
/** Valid only if format is ZPixmap ***/
...
...
src/solaris/native/sun/java2d/x11/X11PMBlitLoops.c
浏览文件 @
786ae0dc
...
...
@@ -263,7 +263,7 @@ Java_sun_java2d_x11_X11PMBlitLoops_updateBitmask
return
;
}
dstScan
=
image
->
bytes_per_line
;
image
->
data
=
malloc
(
dstScan
*
height
);
image
->
data
=
malloc
(
(
size_t
)
dstScan
*
height
);
if
(
image
->
data
==
NULL
)
{
XFree
(
image
);
AWT_UNLOCK
();
...
...
src/solaris/native/sun/java2d/x11/X11TextRenderer_md.c
浏览文件 @
786ae0dc
...
...
@@ -154,7 +154,7 @@ static void FillBitmap(XImage *theImage,
height
=
bottom
-
top
;
top
-=
clipTop
;
left
-=
clipLeft
;
pPix
=
((
jubyte
*
)
theImage
->
data
)
+
(
left
>>
3
)
+
top
*
scan
;
pPix
=
((
jubyte
*
)
theImage
->
data
)
+
(
left
>>
3
)
+
(
intptr_t
)
top
*
scan
;
left
&=
0x07
;
if
(
theImage
->
bitmap_bit_order
==
MSBFirst
)
{
left
=
0x80
>>
left
;
...
...
src/solaris/native/sun/java2d/x11/XRBackendNative.c
浏览文件 @
786ae0dc
...
...
@@ -756,7 +756,7 @@ Java_sun_java2d_xr_XRBackendNative_putMaskNative
if
(
ea
!=
1
.
0
f
)
{
for
(
line
=
0
;
line
<
height
;
line
++
)
{
for
(
pix
=
0
;
pix
<
width
;
pix
++
)
{
int
index
=
maskScan
*
line
+
pix
+
maskOff
;
size_t
index
=
(
size_t
)
maskScan
*
line
+
pix
+
maskOff
;
mask
[
index
]
=
(((
unsigned
char
)
mask
[
index
])
*
ea
);
}
}
...
...
@@ -781,8 +781,8 @@ Java_sun_java2d_xr_XRBackendNative_putMaskNative
if
(
imageFits
)
{
for
(
line
=
0
;
line
<
height
;
line
++
)
{
for
(
pix
=
0
;
pix
<
width
;
pix
++
)
{
img
->
data
[
line
*
img
->
bytes_per_line
+
pix
]
=
(
unsigned
char
)
(
mask
[
maskScan
*
line
+
pix
+
maskOff
]);
img
->
data
[
(
size_t
)
line
*
img
->
bytes_per_line
+
pix
]
=
(
unsigned
char
)
(
mask
[
(
size_t
)
maskScan
*
line
+
pix
+
maskOff
]);
}
}
}
else
{
...
...
test/java/math/BigInteger/ModInvTime.java
0 → 100644
浏览文件 @
786ae0dc
/*
* Copyright (c) 2020, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8225603
* @summary Tests whether modInverse() completes in a reasonable time
* @run main/othervm ModInvTime
*/
import
java.math.BigInteger
;
public
class
ModInvTime
{
public
static
void
main
(
String
[]
args
)
throws
InterruptedException
{
BigInteger
prime
=
new
BigInteger
(
"39402006196394479212279040100143613805079739270465446667946905279627659399113263569398956308152294913554433653942643"
);
BigInteger
s
=
new
BigInteger
(
"9552729729729327851382626410162104591956625415831952158766936536163093322096473638446154604799898109762512409920799"
);
System
.
out
.
format
(
"int length: %d, modulus length: %d%n"
,
s
.
bitLength
(),
prime
.
bitLength
());
System
.
out
.
println
(
"Computing modular inverse ..."
);
BigInteger
mi
=
s
.
modInverse
(
prime
);
System
.
out
.
format
(
"Modular inverse: %s%n"
,
mi
);
check
(
s
,
prime
,
mi
);
BigInteger
ns
=
s
.
negate
();
BigInteger
nmi
=
ns
.
modInverse
(
prime
);
System
.
out
.
format
(
"Modular inverse of negation: %s%n"
,
nmi
);
check
(
ns
,
prime
,
nmi
);
}
public
static
void
check
(
BigInteger
val
,
BigInteger
mod
,
BigInteger
inv
)
{
BigInteger
r
=
inv
.
multiply
(
val
).
remainder
(
mod
);
if
(
r
.
signum
()
==
-
1
)
r
=
r
.
add
(
mod
);
if
(!
r
.
equals
(
BigInteger
.
ONE
))
throw
new
RuntimeException
(
"Numerically incorrect modular inverse"
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录