Skip to content

Commit

Permalink
Merge pull request #31 from EpicPlayerA10/fix/annotation-cp-last-entry
Browse files Browse the repository at this point in the history
Fix reading annotation when type entry is last in the constant pool
  • Loading branch information
Col-E authored Oct 8, 2024
2 parents 26d291b + c7af16a commit 83ea274
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ public AnnotationsAttribute readTypeAnnotations() {
private Annotation readAnnotation(@Nonnull AnnotationScope scope) throws IOException {
int typeIndex = is.readUnsignedShort();
// Validate the type points to an entry in the constant pool that is valid UTF8 item
if (typeIndex >= maxCpIndex) {
logger.warn("Illegally formatted Annotation item, out of CP bounds, type_index={} >= {}",
if (typeIndex > maxCpIndex) {
logger.warn("Illegally formatted Annotation item, out of CP bounds, type_index={} > {}",
typeIndex, maxCpIndex);
throw new IllegalArgumentException("Annotation type_index out of CP bounds!");
}
Expand Down
Binary file not shown.

0 comments on commit 83ea274

Please sign in to comment.