Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
53669696
D
dragonwell8_hotspot
项目概览
openanolis
/
dragonwell8_hotspot
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_hotspot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
53669696
编写于
8月 11, 2016
作者:
V
vkempik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8159507: RuntimeVisibleAnnotation validation
Reviewed-by: rprotacio
上级
704ab198
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
19 addition
and
10 deletion
+19
-10
src/share/vm/classfile/classFileParser.cpp
src/share/vm/classfile/classFileParser.cpp
+19
-10
未找到文件。
src/share/vm/classfile/classFileParser.cpp
浏览文件 @
53669696
...
...
@@ -944,11 +944,12 @@ void ClassFileParser::parse_field_attributes(u2 attributes_count,
runtime_visible_annotations_length
=
attribute_length
;
runtime_visible_annotations
=
cfs
->
get_u1_buffer
();
assert
(
runtime_visible_annotations
!=
NULL
,
"null visible annotations"
);
cfs
->
guarantee_more
(
runtime_visible_annotations_length
,
CHECK
);
parse_annotations
(
runtime_visible_annotations
,
runtime_visible_annotations_length
,
parsed_annotations
,
CHECK
);
cfs
->
skip_u1
(
runtime_visible_annotations_length
,
CHECK
);
cfs
->
skip_u1
_fast
(
runtime_visible_annotations_length
);
}
else
if
(
PreserveAllAnnotations
&&
attribute_name
==
vmSymbols
::
tag_runtime_invisible_annotations
())
{
runtime_invisible_annotations_length
=
attribute_length
;
runtime_invisible_annotations
=
cfs
->
get_u1_buffer
();
...
...
@@ -1655,6 +1656,11 @@ int ClassFileParser::skip_annotation(u1* buffer, int limit, int index) {
return
index
;
}
// Safely increment index by val if does not pass limit
#define SAFE_ADD(index, limit, val) \
if (index >= limit - val) return limit; \
index += val;
// Skip an annotation value. Return >=limit if there is any problem.
int
ClassFileParser
::
skip_annotation_value
(
u1
*
buffer
,
int
limit
,
int
index
)
{
// value := switch (tag:u1) {
...
...
@@ -1665,19 +1671,19 @@ int ClassFileParser::skip_annotation_value(u1* buffer, int limit, int index) {
// case @: annotation;
// case s: s_con:u2;
// }
if
((
index
+=
1
)
>=
limit
)
return
limit
;
// read tag
SAFE_ADD
(
index
,
limit
,
1
);
// read tag
u1
tag
=
buffer
[
index
-
1
];
switch
(
tag
)
{
case
'B'
:
case
'C'
:
case
'I'
:
case
'S'
:
case
'Z'
:
case
'D'
:
case
'F'
:
case
'J'
:
case
'c'
:
case
's'
:
index
+=
2
;
// skip con or s_con
SAFE_ADD
(
index
,
limit
,
2
)
;
// skip con or s_con
break
;
case
'e'
:
index
+=
4
;
// skip e_class, e_name
SAFE_ADD
(
index
,
limit
,
4
)
;
// skip e_class, e_name
break
;
case
'['
:
{
if
((
index
+=
2
)
>=
limit
)
return
limit
;
// read nval
SAFE_ADD
(
index
,
limit
,
2
)
;
// read nval
int
nval
=
Bytes
::
get_Java_u2
(
buffer
+
index
-
2
);
while
(
--
nval
>=
0
&&
index
<
limit
)
{
index
=
skip_annotation_value
(
buffer
,
limit
,
index
);
...
...
@@ -1699,8 +1705,8 @@ void ClassFileParser::parse_annotations(u1* buffer, int limit,
ClassFileParser
::
AnnotationCollector
*
coll
,
TRAPS
)
{
// annotations := do(nann:u2) {annotation}
int
index
=
0
;
if
(
(
index
+=
2
)
>=
limit
)
return
;
// read nann
int
index
=
2
;
if
(
index
>=
limit
)
return
;
// read nann
int
nann
=
Bytes
::
get_Java_u2
(
buffer
+
index
-
2
);
enum
{
// initial annotation layout
atype_off
=
0
,
// utf8 such as 'Ljava/lang/annotation/Retention;'
...
...
@@ -1719,7 +1725,8 @@ void ClassFileParser::parse_annotations(u1* buffer, int limit,
s_size
=
9
,
min_size
=
6
// smallest possible size (zero members)
};
while
((
--
nann
)
>=
0
&&
(
index
-
2
+
min_size
<=
limit
))
{
// Cannot add min_size to index in case of overflow MAX_INT
while
((
--
nann
)
>=
0
&&
(
index
-
2
<=
limit
-
min_size
))
{
int
index0
=
index
;
index
=
skip_annotation
(
buffer
,
limit
,
index
);
u1
*
abase
=
buffer
+
index0
;
...
...
@@ -2324,10 +2331,11 @@ methodHandle ClassFileParser::parse_method(bool is_interface,
runtime_visible_annotations_length
=
method_attribute_length
;
runtime_visible_annotations
=
cfs
->
get_u1_buffer
();
assert
(
runtime_visible_annotations
!=
NULL
,
"null visible annotations"
);
cfs
->
guarantee_more
(
runtime_visible_annotations_length
,
CHECK_
(
nullHandle
));
parse_annotations
(
runtime_visible_annotations
,
runtime_visible_annotations_length
,
&
parsed_annotations
,
CHECK_
(
nullHandle
));
cfs
->
skip_u1
(
runtime_visible_annotations_length
,
CHECK_
(
nullHandle
)
);
cfs
->
skip_u1
_fast
(
runtime_visible_annotations_length
);
}
else
if
(
PreserveAllAnnotations
&&
method_attribute_name
==
vmSymbols
::
tag_runtime_invisible_annotations
())
{
runtime_invisible_annotations_length
=
method_attribute_length
;
runtime_invisible_annotations
=
cfs
->
get_u1_buffer
();
...
...
@@ -2953,11 +2961,12 @@ void ClassFileParser::parse_classfile_attributes(ClassFileParser::ClassAnnotatio
runtime_visible_annotations_length
=
attribute_length
;
runtime_visible_annotations
=
cfs
->
get_u1_buffer
();
assert
(
runtime_visible_annotations
!=
NULL
,
"null visible annotations"
);
cfs
->
guarantee_more
(
runtime_visible_annotations_length
,
CHECK
);
parse_annotations
(
runtime_visible_annotations
,
runtime_visible_annotations_length
,
parsed_annotations
,
CHECK
);
cfs
->
skip_u1
(
runtime_visible_annotations_length
,
CHECK
);
cfs
->
skip_u1
_fast
(
runtime_visible_annotations_length
);
}
else
if
(
PreserveAllAnnotations
&&
tag
==
vmSymbols
::
tag_runtime_invisible_annotations
())
{
runtime_invisible_annotations_length
=
attribute_length
;
runtime_invisible_annotations
=
cfs
->
get_u1_buffer
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录