1.1 --- a/src/share/vm/classfile/classFileParser.cpp Tue Jan 03 10:22:19 2012 -0800 1.2 +++ b/src/share/vm/classfile/classFileParser.cpp Wed Jan 04 12:36:07 2012 -0500 1.3 @@ -1051,7 +1051,7 @@ 1.4 1.5 class FieldAllocationCount: public ResourceObj { 1.6 public: 1.7 - unsigned int count[MAX_FIELD_ALLOCATION_TYPE]; 1.8 + u2 count[MAX_FIELD_ALLOCATION_TYPE]; 1.9 1.10 FieldAllocationCount() { 1.11 for (int i = 0; i < MAX_FIELD_ALLOCATION_TYPE; i++) { 1.12 @@ -1061,6 +1061,8 @@ 1.13 1.14 FieldAllocationType update(bool is_static, BasicType type) { 1.15 FieldAllocationType atype = basic_type_to_atype(is_static, type); 1.16 + // Make sure there is no overflow with injected fields. 1.17 + assert(count[atype] < 0xFFFF, "More than 65535 fields"); 1.18 count[atype]++; 1.19 return atype; 1.20 } 1.21 @@ -1071,7 +1073,7 @@ 1.22 constantPoolHandle cp, bool is_interface, 1.23 FieldAllocationCount *fac, 1.24 objArrayHandle* fields_annotations, 1.25 - int* java_fields_count_ptr, TRAPS) { 1.26 + u2* java_fields_count_ptr, TRAPS) { 1.27 ClassFileStream* cfs = stream(); 1.28 typeArrayHandle nullHandle; 1.29 cfs->guarantee_more(2, CHECK_(nullHandle)); // length 1.30 @@ -2861,7 +2863,7 @@ 1.31 local_interfaces = parse_interfaces(cp, itfs_len, class_loader, protection_domain, _class_name, CHECK_(nullHandle)); 1.32 } 1.33 1.34 - int java_fields_count = 0; 1.35 + u2 java_fields_count = 0; 1.36 // Fields (offsets are filled in later) 1.37 FieldAllocationCount fac; 1.38 objArrayHandle fields_annotations;