Skip to content

Commit

Permalink
Handle corrupt classfiles more robustly (#758)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukehutch committed Mar 9, 2023
1 parent cb7370e commit 153a2c8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main/java/io/github/classgraph/TypeArgument.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,17 @@ protected void addTypeAnnotation(final List<TypePathNode> typePath, final Annota
// Annotation before wildcard
addTypeAnnotation(annotationInfo);
} else if (typePath.size() > 0 && typePath.get(0).typePathKind == 2) {
// Annotation is on the bound of a wildcard type argument of a parameterized type
typeSignature.addTypeAnnotation(typePath.subList(1, typePath.size()), annotationInfo);
// Annotation is on the bound of a wildcard type argument of a parameterized type.
// TypeSignature can be null in a corrupt classfile (#758).
if (typeSignature != null) {
typeSignature.addTypeAnnotation(typePath.subList(1, typePath.size()), annotationInfo);
}
} else {
// Annotation is on a type argument of a parameterized type
typeSignature.addTypeAnnotation(typePath, annotationInfo);
// Annotation is on a type argument of a parameterized type.
// TypeSignature can be null in a corrupt classfile (#758).
if (typeSignature != null) {
typeSignature.addTypeAnnotation(typePath, annotationInfo);
}
}
}

Expand Down

0 comments on commit 153a2c8

Please sign in to comment.