src/share/vm/classfile/classFileParser.cpp
Print this page
*** 2057,2067 ****
u2 max_lvtt_cnt = INITIAL_MAX_LVT_NUMBER;
u2* localvariable_table_length;
u2** localvariable_table_start;
u2* localvariable_type_table_length;
u2** localvariable_type_table_start;
! u2 method_parameters_length = 0;
u1* method_parameters_data = NULL;
bool method_parameters_seen = false;
bool parsed_code_attribute = false;
bool parsed_checked_exceptions_attribute = false;
bool parsed_stackmap_attribute = false;
--- 2057,2067 ----
u2 max_lvtt_cnt = INITIAL_MAX_LVT_NUMBER;
u2* localvariable_table_length;
u2** localvariable_table_start;
u2* localvariable_type_table_length;
u2** localvariable_type_table_start;
! int method_parameters_length = -1;
u1* method_parameters_data = NULL;
bool method_parameters_seen = false;
bool parsed_code_attribute = false;
bool parsed_checked_exceptions_attribute = false;
bool parsed_stackmap_attribute = false;
*** 2276,2296 ****
if (method_parameters_seen) {
classfile_parse_error("Multiple MethodParameters attributes in class file %s", CHECK_(nullHandle));
}
method_parameters_seen = true;
method_parameters_length = cfs->get_u1_fast();
! if (method_attribute_length != (method_parameters_length * 4u) + 1u) {
classfile_parse_error(
"Invalid MethodParameters method attribute length %u in class file",
method_attribute_length, CHECK_(nullHandle));
}
method_parameters_data = cfs->get_u1_buffer();
cfs->skip_u2_fast(method_parameters_length);
cfs->skip_u2_fast(method_parameters_length);
// ignore this attribute if it cannot be reflected
if (!SystemDictionary::Parameter_klass_loaded())
! method_parameters_length = 0;
} else if (method_attribute_name == vmSymbols::tag_synthetic()) {
if (method_attribute_length != 0) {
classfile_parse_error(
"Invalid Synthetic method attribute length %u in class file %s",
method_attribute_length, CHECK_(nullHandle));
--- 2276,2297 ----
if (method_parameters_seen) {
classfile_parse_error("Multiple MethodParameters attributes in class file %s", CHECK_(nullHandle));
}
method_parameters_seen = true;
method_parameters_length = cfs->get_u1_fast();
! const u2 real_length = (method_parameters_length * 4u) + 1u;
! if (method_attribute_length != real_length) {
classfile_parse_error(
"Invalid MethodParameters method attribute length %u in class file",
method_attribute_length, CHECK_(nullHandle));
}
method_parameters_data = cfs->get_u1_buffer();
cfs->skip_u2_fast(method_parameters_length);
cfs->skip_u2_fast(method_parameters_length);
// ignore this attribute if it cannot be reflected
if (!SystemDictionary::Parameter_klass_loaded())
! method_parameters_length = -1;
} else if (method_attribute_name == vmSymbols::tag_synthetic()) {
if (method_attribute_length != 0) {
classfile_parse_error(
"Invalid Synthetic method attribute length %u in class file %s",
method_attribute_length, CHECK_(nullHandle));
*** 2481,2491 ****
copy_u2_with_conversion((u2*) m->exception_table_start(),
exception_table_start, size);
}
// Copy method parameters
! if (method_parameters_length > 0) {
MethodParametersElement* elem = m->constMethod()->method_parameters_start();
for (int i = 0; i < method_parameters_length; i++) {
elem[i].name_cp_index = Bytes::get_Java_u2(method_parameters_data);
method_parameters_data += 2;
elem[i].flags = Bytes::get_Java_u2(method_parameters_data);
--- 2482,2492 ----
copy_u2_with_conversion((u2*) m->exception_table_start(),
exception_table_start, size);
}
// Copy method parameters
! if (method_parameters_length >= 0) {
MethodParametersElement* elem = m->constMethod()->method_parameters_start();
for (int i = 0; i < method_parameters_length; i++) {
elem[i].name_cp_index = Bytes::get_Java_u2(method_parameters_data);
method_parameters_data += 2;
elem[i].flags = Bytes::get_Java_u2(method_parameters_data);