Search code examples
javabytecodedecompiling

Error while decompiling java class: ItemCollectionInvalidIndex: constants: requested 15873, limit 63


I am decompiling java application, and i have already done with 99% .class files. But, I have a problem with couple of them: error while decompilation (errors are same type). Example:

Procyon: java.lang.IllegalArgumentException: Argument 'index' must be in the range [0, 63], but value was: 15873...

CFR:

Can not load the class specified:
org.benf.cfr.reader.util.CannotLoadClassException: Modules_4.class - java.lang.IndexOutOfBoundsException: Constant pool has 62 entries - attempted to access entry #30318

JDCore: returns null

Jadx:

ERROR - jadx error: Error load file: Modules_4.class
jadx.core.utils.exceptions.JadxRuntimeException: Error load file: Modules_4.class
at jadx.api.JadxDecompiler.loadFiles(JadxDecompiler.java:121)
at jadx.api.JadxDecompiler.load(JadxDecompiler.java:88)
at jadx.cli.JadxCLI.processAndSave(JadxCLI.java:34)
at jadx.cli.JadxCLI.main(JadxCLI.java:19)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 15873 out of bounds for length 63

Fernflower:

Job Output:
java.lang.IndexOutOfBoundsException: Index 15873 out of bounds for length 63
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)...

JAD:

Parsing Modules_4.class...The class file version is 50.0 (only 45.3, 46.0 and 47.0 are supported)
ItemCollectionInvalidIndex: constants: requested 15873, limit 63

download .class file

What is wrong?


Solution

  • There is nothing wrong with all decompilers i have mentioned before.

    It was a constant_pool_count issue. It happened because of some JPHP decompiler offset troubles. So, if you are trying to reverse jphp applications, use your own software to delim .phb to .class blocks with couple of bytes before each of them