Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
a43b165b
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看板
提交
a43b165b
编写于
2月 17, 2010
作者:
B
bae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6914866: Sun JRE ImagingLib arbitrary code execution vulnerability
Reviewed-by: prr, hawtin
上级
be74b137
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
54 addition
and
9 deletion
+54
-9
src/share/native/sun/awt/medialib/awt_ImagingLib.c
src/share/native/sun/awt/medialib/awt_ImagingLib.c
+52
-7
src/share/native/sun/awt/medialib/safe_alloc.h
src/share/native/sun/awt/medialib/safe_alloc.h
+2
-2
未找到文件。
src/share/native/sun/awt/medialib/awt_ImagingLib.c
浏览文件 @
a43b165b
...
...
@@ -2239,7 +2239,8 @@ allocateRasterArray(JNIEnv *env, RasterS_t *rasterP,
int
dataType
=
BYTE_DATA_TYPE
;
int
width
;
int
height
;
int
size
=
rasterP
->
width
*
rasterP
->
height
*
rasterP
->
numBands
;
int
dataSize
;
int
offset
;
*
dataPP
=
NULL
;
...
...
@@ -2292,6 +2293,22 @@ allocateRasterArray(JNIEnv *env, RasterS_t *rasterP,
#endif
switch
(
rasterP
->
type
)
{
case
sun_awt_image_IntegerComponentRaster_TYPE_INT_8BIT_SAMPLES
:
if
(
!
((
rasterP
->
chanOffsets
[
0
]
==
0
||
SAFE_TO_ALLOC_2
(
rasterP
->
chanOffsets
[
0
],
4
))
&&
SAFE_TO_ALLOC_2
(
width
,
4
)
&&
SAFE_TO_ALLOC_3
(
height
,
rasterP
->
scanlineStride
,
4
)))
{
return
-
1
;
}
offset
=
4
*
rasterP
->
chanOffsets
[
0
];
dataSize
=
4
*
(
*
env
)
->
GetArrayLength
(
env
,
rasterP
->
jdata
);
if
(
offset
<
0
||
offset
>=
dataSize
||
width
>
rasterP
->
scanlineStride
||
height
*
rasterP
->
scanlineStride
*
4
>
dataSize
-
offset
)
{
// raster data buffer is too short
return
-
1
;
}
dataP
=
(
void
*
)
(
*
env
)
->
GetPrimitiveArrayCritical
(
env
,
rasterP
->
jdata
,
NULL
);
if
(
dataP
==
NULL
)
{
...
...
@@ -2300,11 +2317,25 @@ allocateRasterArray(JNIEnv *env, RasterS_t *rasterP,
*
mlibImagePP
=
(
*
sMlibSysFns
.
createStructFP
)(
MLIB_BYTE
,
4
,
width
,
height
,
rasterP
->
scanlineStride
*
4
,
(
unsigned
char
*
)
dataP
+
rasterP
->
chanOffsets
[
0
]
*
4
);
(
unsigned
char
*
)
dataP
+
offset
);
*
dataPP
=
dataP
;
return
0
;
case
sun_awt_image_IntegerComponentRaster_TYPE_BYTE_SAMPLES
:
if
(
!
(
SAFE_TO_ALLOC_2
(
width
,
rasterP
->
numBands
)
&&
SAFE_TO_ALLOC_2
(
height
,
rasterP
->
scanlineStride
)))
{
return
-
1
;
}
offset
=
rasterP
->
chanOffsets
[
0
];
dataSize
=
(
*
env
)
->
GetArrayLength
(
env
,
rasterP
->
jdata
);
if
(
offset
<
0
||
offset
>=
dataSize
||
width
*
rasterP
->
numBands
>
rasterP
->
scanlineStride
||
height
*
rasterP
->
scanlineStride
>
dataSize
-
offset
)
{
// raster data buffer is too short
return
-
1
;
}
dataP
=
(
void
*
)
(
*
env
)
->
GetPrimitiveArrayCritical
(
env
,
rasterP
->
jdata
,
NULL
);
if
(
dataP
==
NULL
)
{
...
...
@@ -2313,11 +2344,26 @@ allocateRasterArray(JNIEnv *env, RasterS_t *rasterP,
*
mlibImagePP
=
(
*
sMlibSysFns
.
createStructFP
)(
MLIB_BYTE
,
rasterP
->
numBands
,
width
,
height
,
rasterP
->
scanlineStride
,
(
unsigned
char
*
)
dataP
+
rasterP
->
chanOffsets
[
0
]);
(
unsigned
char
*
)
dataP
+
offset
);
*
dataPP
=
dataP
;
return
0
;
case
sun_awt_image_IntegerComponentRaster_TYPE_USHORT_SAMPLES
:
if
(
!
((
rasterP
->
chanOffsets
[
0
]
==
0
||
SAFE_TO_ALLOC_2
(
rasterP
->
chanOffsets
[
0
],
2
))
&&
SAFE_TO_ALLOC_3
(
width
,
rasterP
->
numBands
,
2
)
&&
SAFE_TO_ALLOC_3
(
height
,
rasterP
->
scanlineStride
,
2
)))
{
return
-
1
;
}
offset
=
rasterP
->
chanOffsets
[
0
]
*
2
;
dataSize
=
2
*
(
*
env
)
->
GetArrayLength
(
env
,
rasterP
->
jdata
);
if
(
offset
<
0
||
offset
>=
dataSize
||
width
*
rasterP
->
numBands
>
rasterP
->
scanlineStride
||
height
*
rasterP
->
scanlineStride
*
2
>
dataSize
-
offset
)
{
// raster data buffer is too short
return
-
1
;
}
dataP
=
(
void
*
)
(
*
env
)
->
GetPrimitiveArrayCritical
(
env
,
rasterP
->
jdata
,
NULL
);
if
(
dataP
==
NULL
)
{
...
...
@@ -2327,8 +2373,7 @@ allocateRasterArray(JNIEnv *env, RasterS_t *rasterP,
rasterP
->
numBands
,
width
,
height
,
rasterP
->
scanlineStride
*
2
,
(
unsigned
char
*
)
dataP
+
rasterP
->
chanOffsets
[
0
]
*
2
);
(
unsigned
char
*
)
dataP
+
offset
);
*
dataPP
=
dataP
;
return
0
;
...
...
src/share/native/sun/awt/medialib/safe_alloc.h
浏览文件 @
a43b165b
...
...
@@ -35,11 +35,11 @@
*/
#define SAFE_TO_ALLOC_2(c, sz) \
(((c) > 0) && ((sz) > 0) && \
((0xffffffffu / ((juint)(c))) > (
sz
)))
((0xffffffffu / ((juint)(c))) > (
(juint)(sz)
)))
#define SAFE_TO_ALLOC_3(w, h, sz) \
(((w) > 0) && ((h) > 0) && ((sz) > 0) && \
(((0xffffffffu / ((juint)(w))) / ((juint)(h))) > (sz
)))
(((0xffffffffu / ((juint)(w))) / ((juint)(h))) > ((juint)(sz)
)))
#endif // __SAFE_ALLOC_H__
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录