diff --git a/deobfuscator-api/src/main/java/org/objectweb/asm/tree/analysis/OriginalSourceInterpreter.java b/deobfuscator-api/src/main/java/org/objectweb/asm/tree/analysis/OriginalSourceInterpreter.java index 6bdb83f..ef7519a 100644 --- a/deobfuscator-api/src/main/java/org/objectweb/asm/tree/analysis/OriginalSourceInterpreter.java +++ b/deobfuscator-api/src/main/java/org/objectweb/asm/tree/analysis/OriginalSourceInterpreter.java @@ -27,6 +27,7 @@ // THE POSSIBILITY OF SUCH DAMAGE. package org.objectweb.asm.tree.analysis; +import org.objectweb.asm.ConstantDynamic; import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; import org.objectweb.asm.tree.AbstractInsnNode; @@ -90,8 +91,22 @@ public OriginalSourceValue newOperation(final AbstractInsnNode insn) { size = 2; break; case LDC: + // Values able to be pushed by LDC: + // - int, float, string (object), type (Class, object), type (MethodType, object), + // handle (MethodHandle, object): one word + // - long, double, ConstantDynamic (can produce either single word values, or double word + // values): (up to) two words Object value = ((LdcInsnNode) insn).cst; - size = value instanceof Long || value instanceof Double ? 2 : 1; + if (value instanceof Long || value instanceof Double) { + // two words guaranteed + size = 2; + } else if (value instanceof ConstantDynamic) { + // might yield two words + size = ((ConstantDynamic) value).getSize(); + } else { + // one word guaranteed + size = 1; + } break; case GETSTATIC: size = Type.getType(((FieldInsnNode) insn).desc).getSize();