Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
3c4bc4cd
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看板
提交
3c4bc4cd
编写于
9月 10, 2009
作者:
B
bae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6632445: DoS from parsing BMPs with UNC ICC links
Reviewed-by: prr, hawtin
上级
e2c2ec86
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
76 addition
and
3 deletion
+76
-3
src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java
...e/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java
+76
-3
未找到文件。
src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java
浏览文件 @
3c4bc4cd
...
...
@@ -62,6 +62,8 @@ import javax.imageio.event.IIOReadWarningListener;
import
java.io.*
;
import
java.nio.*
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.StringTokenizer
;
...
...
@@ -502,12 +504,18 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
iis
.
reset
();
try
{
if
(
metadata
.
colorSpace
==
PROFILE_LINKED
)
if
(
metadata
.
colorSpace
==
PROFILE_LINKED
&&
isLinkedProfileAllowed
()
&&
!
isUncOrDevicePath
(
profile
))
{
String
path
=
new
String
(
profile
,
"windows-1252"
);
colorSpace
=
new
ICC_ColorSpace
(
ICC_Profile
.
getInstance
(
new
String
(
profile
)
));
else
new
ICC_ColorSpace
(
ICC_Profile
.
getInstance
(
path
));
}
else
{
colorSpace
=
new
ICC_ColorSpace
(
ICC_Profile
.
getInstance
(
profile
));
}
}
catch
(
Exception
e
)
{
colorSpace
=
ColorSpace
.
getInstance
(
ColorSpace
.
CS_sRGB
);
}
...
...
@@ -1745,4 +1753,69 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
public
void
sequenceStarted
(
ImageReader
src
,
int
minIndex
)
{}
public
void
readAborted
(
ImageReader
src
)
{}
}
private
static
Boolean
isLinkedProfileDisabled
=
null
;
private
static
boolean
isLinkedProfileAllowed
()
{
if
(
isLinkedProfileDisabled
==
null
)
{
PrivilegedAction
<
Boolean
>
a
=
new
PrivilegedAction
<
Boolean
>()
{
public
Boolean
run
()
{
return
Boolean
.
getBoolean
(
"sun.imageio.plugins.bmp.disableLinkedProfiles"
);
}
};
isLinkedProfileDisabled
=
AccessController
.
doPrivileged
(
a
);
}
return
!
isLinkedProfileDisabled
;
}
private
static
Boolean
isWindowsPlatform
=
null
;
/**
* Verifies whether the byte array contans a unc path.
* Non-UNC path examples:
* c:\path\to\file - simple notation
* \\?\c:\path\to\file - long notation
*
* UNC path examples:
* \\server\share - a UNC path in simple notation
* \\?\UNC\server\share - a UNC path in long notation
* \\.\some\device - a path to device.
*/
private
static
boolean
isUncOrDevicePath
(
byte
[]
p
)
{
if
(
isWindowsPlatform
==
null
)
{
PrivilegedAction
<
Boolean
>
a
=
new
PrivilegedAction
<
Boolean
>()
{
public
Boolean
run
()
{
String
osname
=
System
.
getProperty
(
"os.name"
);
return
(
osname
!=
null
&&
osname
.
toLowerCase
().
startsWith
(
"win"
));
}
};
isWindowsPlatform
=
AccessController
.
doPrivileged
(
a
);
}
if
(!
isWindowsPlatform
)
{
/* no need for the check on platforms except windows */
return
false
;
}
/* normalize prefix of the path */
if
(
p
[
0
]
==
'/'
)
p
[
0
]
=
'\\'
;
if
(
p
[
1
]
==
'/'
)
p
[
1
]
=
'\\'
;
if
(
p
[
3
]
==
'/'
)
p
[
3
]
=
'\\'
;
if
((
p
[
0
]
==
'\\'
)
&&
(
p
[
1
]
==
'\\'
))
{
if
((
p
[
2
]
==
'?'
)
&&
(
p
[
3
]
==
'\\'
))
{
// long path: whether unc or local
return
((
p
[
4
]
==
'U'
||
p
[
4
]
==
'u'
)
&&
(
p
[
5
]
==
'N'
||
p
[
5
]
==
'n'
)
&&
(
p
[
6
]
==
'C'
||
p
[
6
]
==
'c'
));
}
else
{
// device path or short unc notation
return
true
;
}
}
else
{
return
false
;
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录