From 1c3a283ac327b8c673321999c5817996872b7fcc Mon Sep 17 00:00:00 2001 From: Ben Gruver Date: Tue, 30 Oct 2012 23:43:25 -0700 Subject: [PATCH] Position the reader correctly after a nop --- .../dexlib2/dexbacked/instruction/DexBackedInstruction.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/instruction/DexBackedInstruction.java b/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/instruction/DexBackedInstruction.java index b55f837f..0fefcf0f 100644 --- a/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/instruction/DexBackedInstruction.java +++ b/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/instruction/DexBackedInstruction.java @@ -48,6 +48,11 @@ public abstract class DexBackedInstruction { if (opcodeValue == 0) { reader.moveRelative(-1); opcodeValue = reader.readUshort(); + if (opcodeValue == 0) { + // if we've got a real nop, and not a payload instruction, back up a byte, + // so that the reader is positioned just after the single opcode byte, for consistency + reader.moveRelative(-1); + } } Opcode opcode = Opcode.getOpcodeByValue(opcodeValue);