Skip to content

Commit

Permalink
Merge pull request #13734 from pshipton/attribute29
Browse files Browse the repository at this point in the history
(0.29.0) Capture the error with outer class in the InnerClasses Attribute
  • Loading branch information
keithc-ca authored Oct 19, 2021
2 parents 6b916cd + 8348733 commit e1e72c4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
16 changes: 16 additions & 0 deletions runtime/bcutil/cfreader.c
Original file line number Diff line number Diff line change
Expand Up @@ -2168,6 +2168,22 @@ checkAttributes(J9PortLibrary* portLib, J9CfrClassFile* classfile, J9CfrAttribut
errorCode = J9NLS_CFR_ERR_OUTER_CLASS_NOT_CLASS__ID;
goto _errorFound;
}
if (0 != value) {
J9CfrConstantPoolInfo* outerClassInfoUtf8 = &cpBase[cpBase[value].slot1];
if (CFR_CONSTANT_Utf8 != outerClassInfoUtf8->tag) {
errorCode = J9NLS_CFR_ERR_OUTER_CLASS_NAME_NOT_UTF8__ID;
goto _errorFound;
}
if (0 == outerClassInfoUtf8->slot1) {
errorCode = J9NLS_CFR_ERR_OUTER_CLASS_UTF8_ZERO_LENGTH__ID;
goto _errorFound;
}
/* Capture the error if the outer_class_info_index points to an array class */
if ('[' == outerClassInfoUtf8->bytes[0]) {
errorCode = J9NLS_CFR_ERR_OUTER_CLASS_BAD_ARRAY_CLASS__ID;
goto _errorFound;
}
}
/* Check class name integrity? */

value = classes->classes[j].innerNameIndex;
Expand Down
24 changes: 24 additions & 0 deletions runtime/nls/cfre/cfrerr.nls
Original file line number Diff line number Diff line change
Expand Up @@ -1566,3 +1566,27 @@ J9NLS_CFR_ERR_BC_JUMP_RECURSIVE.explanation=The JVM is unable to flatten the cod
J9NLS_CFR_ERR_BC_JUMP_RECURSIVE.system_action=The JVM will throw a verification or class loading-related exception such as java.lang.ClassFormatError.
J9NLS_CFR_ERR_BC_JUMP_RECURSIVE.user_response=Contact the provider of the class file for a corrected version.
# END NON-TRANSLATABLE

J9NLS_CFR_ERR_OUTER_CLASS_NAME_NOT_UTF8=Outer class name must be a string
# START NON-TRANSLATABLE
J9NLS_CFR_ERR_OUTER_CLASS_NAME_NOT_UTF8.explanation=The outer class name of an InnerClasses attribute must be a string in the case of a non-zero outer class info index.
J9NLS_CFR_ERR_OUTER_CLASS_NAME_NOT_UTF8.system_action=The JVM will throw a verification or classloading-related exception such as java.lang.ClassFormatError.
J9NLS_CFR_ERR_OUTER_CLASS_NAME_NOT_UTF8.user_response=Contact the provider of the classfile for a corrected version.

# END NON-TRANSLATABLE

J9NLS_CFR_ERR_OUTER_CLASS_UTF8_ZERO_LENGTH=The length of outer class name is zero in an InnerClasses attribute
# START NON-TRANSLATABLE
J9NLS_CFR_ERR_OUTER_CLASS_UTF8_ZERO_LENGTH.explanation=The outer class name of an InnerClasses attribute must be a non-zero UTF8 string.
J9NLS_CFR_ERR_OUTER_CLASS_UTF8_ZERO_LENGTH.system_action=The JVM will throw a verification or classloading-related exception such as java.lang.ClassFormatError.
J9NLS_CFR_ERR_OUTER_CLASS_UTF8_ZERO_LENGTH.user_response=Contact the provider of the classfile for a corrected version.

# END NON-TRANSLATABLE

J9NLS_CFR_ERR_OUTER_CLASS_BAD_ARRAY_CLASS=Outer class is an array class in an InnerClasses attribute
# START NON-TRANSLATABLE
J9NLS_CFR_ERR_OUTER_CLASS_BAD_ARRAY_CLASS.explanation=The outer class of an InnerClasses attribute must be a non-array class.
J9NLS_CFR_ERR_OUTER_CLASS_BAD_ARRAY_CLASS.system_action=The JVM will throw a verification or classloading-related exception such as java.lang.ClassFormatError.
J9NLS_CFR_ERR_OUTER_CLASS_BAD_ARRAY_CLASS.user_response=Contact the provider of the classfile for a corrected version.

# END NON-TRANSLATABLE

0 comments on commit e1e72c4

Please sign in to comment.