-
Bug
-
Resolution: Fixed
-
P4
-
8
Format checking of a class file requires that "All recognized attributes must be of the proper length" but the precise meaning of "recognized" is not clear. It could mean only the five attributes recognized by the JVM itself; or those five plus the twelve attributes recognized by class libraries to support reflection; or all 23 predefined attributes.
It turns out that:
a) HotSpot checks the attribute_length item of almost all attributes. Sometimes this is simple - comparing ConstantValue.attribute_length to 2, say - and sometimes it is complex - summing the sizes and lengths of items in the Code attribute, say.
b) One attribute (SourceDebugExtension) cannot be checked because there is nothing to compare its attribute_length with.
c) Eight attributes (StackMapTable, Runtime*Annotations, AnnotationDefault) cannot be checked in any reasonable manner, because they contain items whose size/length is context-sensitive.
JVMS 4.8 should be clarified to say:
- All predefined attributes (4.7) must be of the proper length, except for StackMapTable, Runtime*Annotations, and AnnotationDefault.
It turns out that:
a) HotSpot checks the attribute_length item of almost all attributes. Sometimes this is simple - comparing ConstantValue.attribute_length to 2, say - and sometimes it is complex - summing the sizes and lengths of items in the Code attribute, say.
b) One attribute (SourceDebugExtension) cannot be checked because there is nothing to compare its attribute_length with.
c) Eight attributes (StackMapTable, Runtime*Annotations, AnnotationDefault) cannot be checked in any reasonable manner, because they contain items whose size/length is context-sensitive.
JVMS 4.8 should be clarified to say:
- All predefined attributes (4.7) must be of the proper length, except for StackMapTable, Runtime*Annotations, and AnnotationDefault.
- relates to
-
JDK-8044738 HotSpot must check attribute_length of EnclosingMethod attribute
-
- Closed
-