Storyyeller / Krakatau

Java decompiler, assembler, and disassembler
GNU General Public License v3.0
1.95k stars 219 forks source link

Missing undocumented opcodes. #189

Closed toxamin closed 1 year ago

toxamin commented 1 year ago

afaik they're generated by the jvm or some shit (who knows). basically disassembly fails on this sample because of it BukkitPlatform.zip

BREAKPOINT = 202; LDC_QUICK = 203; LDC_W_QUICK = 204; LDC2_W_QUICK = 205; GETFIELD_QUICK = 206; PUTFIELD_QUICK = 207; GETFIELD2_QUICK = 208; PUTFIELD2_QUICK = 209; GETSTATIC_QUICK = 210; PUTSTATIC_QUICK = 211; GETSTATIC2_QUICK = 212; PUTSTATIC2_QUICK = 213; INVOKEVIRTUAL_QUICK = 214; INVOKENONVIRTUAL_QUICK = 215; INVOKESUPER_QUICK = 216; INVOKESTATIC_QUICK = 217; INVOKEINTERFACE_QUICK = 218; INVOKEVIRTUALOBJECT_QUICK = 219; NEW_QUICK = 221; ANEWARRAY_QUICK = 222; MULTIANEWARRAY_QUICK = 223; CHECKCAST_QUICK = 224; INSTANCEOF_QUICK = 225; INVOKEVIRTUAL_QUICK_W = 226; GETFIELD_QUICK_W = 227; PUTFIELD_QUICK_W = 228; IMPDEP1 = 254; IMPDEP2 = 255;

Storyyeller commented 1 year ago

Is there any way to actually load a classfile with those opcodes? I don't think they're actually usable.

Janmm14 commented 1 year ago

From my test, the class cannot load with jdk17.

However it might be possible that the spigot server does some class editing beforehand so its loadable. Maybe its a side effect of class editing, which the server does for old plugin support.

Fehler: Hauptklasse com.plotsquared.bukkit.BukkitPlatform kann nicht initialisiert werden
Ursache: java.lang.VerifyError: Bad instruction
Exception Details:
  Location:
    com/plotsquared/bukkit/BukkitPlatform.onEnable()V @976: <illegal>
  Reason:
    Error exists in the bytecode
  Bytecode:
    [...]
  Exception Handler Table:
    bci [99, 110] => handler: 113
    bci [365, 372] => handler: 375
    bci [405, 441] => handler: 444
    bci [867, 880] => handler: 883
    bci [1707, 1739] => handler: 1742
  Stackmap Table:
    [...]
Storyyeller commented 1 year ago

As far as I know, the undocumented opcodes were never supported in classes loaded by the JVM. It's just an internal implementation detail. But there might be some secret way to make use of them.