Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
3cec7b5c
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看板
提交
3cec7b5c
编写于
8月 25, 2015
作者:
R
robm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8087190: Regression in sun.net.util.IPAddressUtil.isIPv4LiteralAddress(String)
Reviewed-by: chegar
上级
2ad1db03
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
22 addition
and
5 deletion
+22
-5
src/share/classes/sun/net/util/IPAddressUtil.java
src/share/classes/sun/net/util/IPAddressUtil.java
+6
-3
test/java/net/Inet4Address/textToNumericFormat.java
test/java/net/Inet4Address/textToNumericFormat.java
+6
-2
test/sun/net/util/IPAddressUtilTest.java
test/sun/net/util/IPAddressUtilTest.java
+10
-0
未找到文件。
src/share/classes/sun/net/util/IPAddressUtil.java
浏览文件 @
3cec7b5c
/*
/*
* Copyright (c) 2004, 20
0
5, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 20
1
5, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -44,6 +44,7 @@ public class IPAddressUtil {
...
@@ -44,6 +44,7 @@ public class IPAddressUtil {
long
tmpValue
=
0
;
long
tmpValue
=
0
;
int
currByte
=
0
;
int
currByte
=
0
;
boolean
newOctet
=
true
;
int
len
=
src
.
length
();
int
len
=
src
.
length
();
if
(
len
==
0
||
len
>
15
)
{
if
(
len
==
0
||
len
>
15
)
{
...
@@ -77,11 +78,12 @@ public class IPAddressUtil {
...
@@ -77,11 +78,12 @@ public class IPAddressUtil {
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
char
c
=
src
.
charAt
(
i
);
char
c
=
src
.
charAt
(
i
);
if
(
c
==
'.'
)
{
if
(
c
==
'.'
)
{
if
(
tmpValue
<
0
||
tmpValue
>
0xff
||
currByte
==
3
)
{
if
(
newOctet
||
tmpValue
<
0
||
tmpValue
>
0xff
||
currByte
==
3
)
{
return
null
;
return
null
;
}
}
res
[
currByte
++]
=
(
byte
)
(
tmpValue
&
0xff
);
res
[
currByte
++]
=
(
byte
)
(
tmpValue
&
0xff
);
tmpValue
=
0
;
tmpValue
=
0
;
newOctet
=
true
;
}
else
{
}
else
{
int
digit
=
Character
.
digit
(
c
,
10
);
int
digit
=
Character
.
digit
(
c
,
10
);
if
(
digit
<
0
)
{
if
(
digit
<
0
)
{
...
@@ -89,9 +91,10 @@ public class IPAddressUtil {
...
@@ -89,9 +91,10 @@ public class IPAddressUtil {
}
}
tmpValue
*=
10
;
tmpValue
*=
10
;
tmpValue
+=
digit
;
tmpValue
+=
digit
;
newOctet
=
false
;
}
}
}
}
if
(
tmpValue
<
0
||
tmpValue
>=
(
1L
<<
((
4
-
currByte
)
*
8
)))
{
if
(
newOctet
||
tmpValue
<
0
||
tmpValue
>=
(
1L
<<
((
4
-
currByte
)
*
8
)))
{
return
null
;
return
null
;
}
}
switch
(
currByte
)
{
switch
(
currByte
)
{
...
...
test/java/net/Inet4Address/textToNumericFormat.java
浏览文件 @
3cec7b5c
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
/*
/*
* @test
* @test
* @bug 4749938
* @bug 4749938
8087190
* @summary Bug in the parsing IPv4 literal addresses
* @summary Bug in the parsing IPv4 literal addresses
* @compile -XDignore.symbol.file=true DummyNameService.java DummyNameServiceDescriptor.java
* @compile -XDignore.symbol.file=true DummyNameService.java DummyNameServiceDescriptor.java
* @run main/othervm -Dsun.net.spi.nameservice.provider.1=dummy,oracle textToNumericFormat
* @run main/othervm -Dsun.net.spi.nameservice.provider.1=dummy,oracle textToNumericFormat
...
@@ -62,7 +62,11 @@ public class textToNumericFormat {
...
@@ -62,7 +62,11 @@ public class textToNumericFormat {
"2380.255.255.255"
,
"2380.255.255.255"
,
"239.255.65536"
,
"239.255.65536"
,
"239.16777216"
,
"239.16777216"
,
"4294967296"
};
"4294967296"
,
".1.1.1"
,
"1..1.1"
,
"1.1.1."
,
"..."
};
for
(
int
i
=
0
;
i
<
goodAddrs
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
goodAddrs
.
length
;
i
++)
{
try
{
try
{
...
...
test/sun/net/util/IPAddressUtilTest.java
浏览文件 @
3cec7b5c
...
@@ -21,6 +21,12 @@
...
@@ -21,6 +21,12 @@
* questions.
* questions.
*/
*/
/*
* @test
* @bug 8087190
* @summary Exercise the sun.net.util.IPAddressUtil class
*/
import
sun.net.util.*
;
import
sun.net.util.*
;
/*
/*
...
@@ -39,6 +45,10 @@ public class IPAddressUtilTest {
...
@@ -39,6 +45,10 @@ public class IPAddressUtilTest {
{
"238.255.2550.255"
,
bad
},
{
"238.255.2550.255"
,
bad
},
{
"238.2550.255.255"
,
bad
},
{
"238.2550.255.255"
,
bad
},
{
"2380.255.255.255"
,
bad
},
{
"2380.255.255.255"
,
bad
},
{
".1.1.1"
,
bad
},
{
"1..1.1"
,
bad
},
{
"1.1.1."
,
bad
},
{
"..."
,
bad
},
{
"10::10"
,
good
},
{
"10::10"
,
good
},
{
"10::10.1"
,
bad
},
{
"10::10.1"
,
bad
},
{
"10::10.1.2"
,
bad
},
{
"10::10.1.2"
,
bad
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录