Skip to content

Commit

Permalink
Add constant pool tag type 17 (#527)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukehutch committed Jun 6, 2021
1 parent c5bc253 commit baf88b8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/java/io/github/classgraph/Classfile.java
Expand Up @@ -928,7 +928,7 @@ private Object getFieldConstantPoolValue(final int tag, final char fieldTypeDesc
default:
// ClassGraph doesn't expect other types
// (N.B. in particular, enum values are not stored in the constant pool, so don't need to be handled)
throw new ClassfileFormatException("Unknown constant pool tag " + tag + ", "
throw new ClassfileFormatException("Unknown field constant pool tag " + tag + ", "
+ "cannot continue reading class. Please report this at "
+ "https://github.com/classgraph/classgraph/issues");
}
Expand Down Expand Up @@ -1097,13 +1097,14 @@ private void readConstantPoolEntries() throws IOException {
entryOffset[i] = reader.currPos();
switch (entryTag[i]) {
case 0: // Impossible, probably buffer underflow
throw new ClassfileFormatException("Unknown constant pool tag 0 in classfile " + relativePath
throw new ClassfileFormatException("Invalid constant pool tag 0 in classfile " + relativePath
+ " (possible buffer underflow issue). Please report this at "
+ "https://github.com/classgraph/classgraph/issues");
case 1: // Modified UTF8
final int strLen = reader.readUnsignedShort();
reader.skip(strLen);
break;
// There is no constant pool tag type 2
case 3: // int, short, char, byte, boolean are all represented by Constant_INTEGER
case 4: // float
reader.skip(4);
Expand Down Expand Up @@ -1145,12 +1146,16 @@ private void readConstantPoolEntries() throws IOException {
}
indirectStringRefs[i] = (nameRef << 16) | typeRef;
break;
// There is no constant pool tag type 13 or 14
case 15: // method handle
reader.skip(3);
break;
case 16: // method type
reader.skip(2);
break;
case 17: // dynamic
reader.skip(4);
break;
case 18: // invoke dynamic
reader.skip(4);
break;
Expand Down

0 comments on commit baf88b8

Please sign in to comment.