This commit is contained in:
Phil Race 2014-09-22 12:06:36 -07:00
commit 4f42e3fa2c
14 changed files with 93 additions and 30 deletions

View File

@ -368,7 +368,7 @@ public class CookieManager extends CookieHandler
int val = -1;
while (i > 0) {
try {
val = Integer.parseInt(lst.substring(0, i));
val = Integer.parseInt(lst, 0, i, 10);
if (val == port) {
return true;
}

View File

@ -3250,7 +3250,7 @@ public final class URI
if (q > p) {
checkChars(p, q, L_DIGIT, H_DIGIT, "port number");
try {
port = Integer.parseInt(substring(p, q));
port = Integer.parseInt(input, p, q, 10);
} catch (NumberFormatException x) {
fail("Malformed port number", p);
}
@ -3271,7 +3271,7 @@ public final class URI
int p = start;
int q = scan(p, n, L_DIGIT, H_DIGIT);
if (q <= p) return q;
if (Integer.parseInt(substring(p, q)) > 255) return p;
if (Integer.parseInt(input, p, q, 10) > 255) return p;
return q;
}

View File

@ -171,7 +171,7 @@ public class URLDecoder {
while ( ((i+2) < numChars) &&
(c=='%')) {
int v = Integer.parseInt(s.substring(i+1,i+3),16);
int v = Integer.parseInt(s, i + 1, i + 3, 16);
if (v < 0)
throw new IllegalArgumentException("URLDecoder: Illegal hex characters in escape (%) pattern - negative value");
bytes[pos++] = (byte) v;

View File

@ -196,7 +196,8 @@ public abstract class URLStreamHandler {
++ind ;
// port can be null according to RFC2396
if (nhost.length() > (ind + 1)) {
port = Integer.parseInt(nhost.substring(ind+1));
port = Integer.parseInt(nhost, ind + 1,
nhost.length(), 10);
}
} else {
throw new IllegalArgumentException(
@ -213,7 +214,8 @@ public abstract class URLStreamHandler {
if (ind >= 0) {
// port can be null according to RFC2396
if (host.length() > (ind + 1)) {
port = Integer.parseInt(host.substring(ind + 1));
port = Integer.parseInt(host, ind + 1,
host.length(), 10);
}
host = host.substring(0, ind);
}

View File

@ -1992,21 +1992,32 @@ public class FloatingDecimal{
break expLoop; // stop parsing exponent.
}
}
int expLimit = BIG_DECIMAL_EXPONENT+nDigits+nTrailZero;
if ( expOverflow || ( expVal > expLimit ) ){
//
// The intent here is to end up with
// infinity or zero, as appropriate.
// The reason for yielding such a small decExponent,
// rather than something intuitive such as
// expSign*Integer.MAX_VALUE, is that this value
// is subject to further manipulation in
// doubleValue() and floatValue(), and I don't want
// it to be able to cause overflow there!
// (The only way we can get into trouble here is for
// really outrageous nDigits+nTrailZero, such as 2 billion. )
//
decExp = expSign*expLimit;
int expLimit = BIG_DECIMAL_EXPONENT + nDigits + nTrailZero;
if (expOverflow || (expVal > expLimit)) {
// There is still a chance that the exponent will be safe to
// use: if it would eventually decrease due to a negative
// decExp, and that number is below the limit. We check for
// that here.
if (!expOverflow && (expSign == 1 && decExp < 0)
&& (expVal + decExp) < expLimit) {
// Cannot overflow: adding a positive and negative number.
decExp += expVal;
} else {
//
// The intent here is to end up with
// infinity or zero, as appropriate.
// The reason for yielding such a small decExponent,
// rather than something intuitive such as
// expSign*Integer.MAX_VALUE, is that this value
// is subject to further manipulation in
// doubleValue() and floatValue(), and I don't want
// it to be able to cause overflow there!
// (The only way we can get into trouble here is for
// really outrageous nDigits+nTrailZero, such as 2
// billion.)
//
decExp = expSign * expLimit;
}
} else {
// this should not overflow, since we tested
// for expVal > (MAX+N), where N >= abs(decExp)

View File

@ -80,7 +80,7 @@ public class TransferProtocolClient extends NetworkClient {
code = -1;
} else {
try {
code = Integer.parseInt(response.substring(0, 3));
code = Integer.parseInt(response, 0, 3, 10);
} catch (NumberFormatException e) {
code = -1;
} catch (StringIndexOutOfBoundsException e) {

View File

@ -260,8 +260,8 @@ public class FtpClient extends sun.net.ftp.FtpClient {
if (d != null && time != null) {
int c = time.indexOf(':');
now.setTime(d);
now.set(Calendar.HOUR, Integer.parseInt(time.substring(0, c)));
now.set(Calendar.MINUTE, Integer.parseInt(time.substring(c + 1)));
now.set(Calendar.HOUR, Integer.parseInt(time, 0, c, 10));
now.set(Calendar.MINUTE, Integer.parseInt(time, c + 1, time.length(), 10));
d = now.getTime();
}
// see if it's a symbolic link, i.e. the name if followed
@ -437,7 +437,7 @@ public class FtpClient extends sun.net.ftp.FtpClient {
code = -1;
} else {
try {
code = Integer.parseInt(response.substring(0, 3));
code = Integer.parseInt(response, 0, 3, 10);
} catch (NumberFormatException e) {
code = -1;
} catch (StringIndexOutOfBoundsException e) {

View File

@ -161,7 +161,7 @@ public class ParseUtil {
* Un-escape and return the character at position i in string s.
*/
private static byte unescape(String s, int i) {
return (byte) Integer.parseInt(s.substring(i+1,i+3),16);
return (byte) Integer.parseInt(s, i + 1, i + 3, 16);
}

View File

@ -313,7 +313,7 @@ class ChunkedInputStream extends InputStream implements Hurryable {
break;
}
try {
chunkSize = Integer.parseInt(header.substring(0, i), 16);
chunkSize = Integer.parseInt(header, 0, i, 16);
} catch (NumberFormatException e) {
error = true;
throw new IOException("Bogus chunk size");

View File

@ -808,7 +808,7 @@ public class HttpClient extends NetworkClient {
ind = resp.indexOf(' ');
while(resp.charAt(ind) == ' ')
ind++;
code = Integer.parseInt(resp.substring(ind, ind + 3));
code = Integer.parseInt(resp, ind, ind + 3, 10);
} catch (Exception e) {}
if (code == HTTP_CONTINUE && ignoreContinue) {

View File

@ -257,7 +257,8 @@ public class SdpProvider extends NetHooks.Provider {
.getByName(s[1].substring(0, pos));
int prefix = -1;
try {
prefix = Integer.parseInt(s[1].substring(pos+1));
prefix = Integer.parseInt(s[1], pos + 1,
s[1].length(), 10);
if (address instanceof Inet4Address) {
// must be 1-31
if (prefix < 0 || prefix > 32) prefix = -1;

View File

@ -23,6 +23,7 @@
* questions.
*/
#include <windows.h>
#include <Sddl.h>
#include <string.h>
#include "jni.h"
@ -258,6 +259,25 @@ JNIEXPORT jlong JNICALL Java_sun_tools_attach_VirtualMachineImpl_createPipe
HANDLE hPipe;
char name[MAX_PIPE_NAME_LENGTH];
SECURITY_ATTRIBUTES sa;
LPSECURITY_ATTRIBUTES lpSA = NULL;
// Custom Security Descriptor is required here to "get" Medium Integrity Level.
// In order to allow Medium Integrity Level clients to open
// and use a NamedPipe created by an High Integrity Level process.
TCHAR *szSD = TEXT("D:") // Discretionary ACL
TEXT("(A;OICI;GRGW;;;WD)") // Allow read/write to Everybody
TEXT("(A;OICI;GA;;;SY)") // Allow full control to System
TEXT("(A;OICI;GA;;;BA)"); // Allow full control to Administrators
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.bInheritHandle = FALSE;
sa.lpSecurityDescriptor = NULL;
if (ConvertStringSecurityDescriptorToSecurityDescriptor
(szSD, SDDL_REVISION_1, &(sa.lpSecurityDescriptor), NULL)) {
lpSA = &sa;
}
jstring_to_cstring(env, pipename, name, MAX_PIPE_NAME_LENGTH);
hPipe = CreateNamedPipe(
@ -270,7 +290,9 @@ JNIEXPORT jlong JNICALL Java_sun_tools_attach_VirtualMachineImpl_createPipe
128, // output buffer size
8192, // input buffer size
NMPWAIT_USE_DEFAULT_WAIT, // client time-out
NULL); // default security attribute
lpSA); // security attributes
LocalFree(sa.lpSecurityDescriptor);
if (hPipe == INVALID_HANDLE_VALUE) {
char msg[256];

View File

@ -130,6 +130,12 @@ com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationTest.java
# 8056143
java/lang/management/MemoryMXBean/LowMemoryTest.java generic-all
# 8058492
java/lang/management/ThreadMXBean/FindDeadlocks.java generic-all
# 8058506
java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java generic-all
############################################################################
# jdk_jmx
@ -268,6 +274,9 @@ com/sun/jdi/RepStep.java generic-all
# 8044419
com/sun/jdi/JdbReadTwiceTest.sh generic-all
# 8058616
com/sun/jdi/RedefinePop.sh generic-all
############################################################################
# jdk_util
@ -298,4 +307,7 @@ sun/tools/jstatd/TestJstatdExternalRegistry.java generic-all
# 6456333
sun/tools/jps/TestJpsJarRelative.java generic-all
# 8057732
sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java generic-all
############################################################################

View File

@ -512,6 +512,21 @@ public class ParseDouble {
"2.2250738585072014e-308", // Double.MIN_NORMAL
"2.2250738585072012e-308", // near Double.MIN_NORMAL
"1.7976931348623158e+308", // near MAX_VALUE + ulp(MAX_VALUE)/2
"1.7976931348623159e+308", // near MAX_VALUE + ulp(MAX_VALUE)
"2.4703282292062329e-324", // above MIN_VALUE/2
"2.4703282292062327e-324", // MIN_VALUE/2
"2.4703282292062325e-324", // below MIN_VALUE/2
// 1e308 with leading zeros
"0.0000000000001e321",
"00.000000000000000001e326",
"00000.000000000000000001e326",
"000.0000000000000000001e327",
"0.00000000000000000001e328",
};
static String paddedBadStrings[];