diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index 4423c8a08..3c6d4d2ed 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -1779,6 +1779,7 @@ public final class SWF implements SWFContainerItem, Timelined { ABC abc = abcTag.getABC(); for (MethodBody body : abc.bodies) { AVM2Code code = body.getCode(); + body.setCodeBytes(code.getBytes()); } ((Tag) abcTag).setModified(true); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java index 981416490..cf3857673 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java @@ -182,7 +182,7 @@ public class ABCInputStream implements AutoCloseable { ret += (((long) i) << bytePos); byteCount++; bytePos += 7; - } while (nextByte); + } while (nextByte && byteCount < 5); return ret; } @@ -243,7 +243,7 @@ public class ABCInputStream implements AutoCloseable { } break; } - } while (nextByte); + } while (nextByte && byteCount < 5); endDumpLevel(ret); return ret; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java index 390ab7a40..47817f2b5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java @@ -100,7 +100,7 @@ public final class MethodBody implements Cloneable { } public synchronized byte[] getCodeBytes() { - if (code == null) { + if (codeBytes != null) { return codeBytes; } else { return code.getBytes(); @@ -125,6 +125,7 @@ public final class MethodBody implements Cloneable { public void setCode(AVM2Code code) { this.code = code; + this.codeBytes = null; } public List getExceptionEntries() { diff --git a/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java b/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java index 0b2218c72..5689b3a54 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java +++ b/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java @@ -892,7 +892,7 @@ public class Helper { } public static GraphTextWriter byteArrayToHexWithHeader(GraphTextWriter writer, byte[] data) { - writer.appendNoHilight("#hexdata").newLine().newLine(); + writer.appendNoHilight(hexData).newLine().newLine(); return byteArrayToHex(writer, data, 8, 8, false, false); } diff --git a/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java b/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java index 2cf4a8366..a42b3ead9 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java @@ -114,7 +114,7 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi changeContentType("text/plain"); if (textHexOnly == null) { HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), true); - Helper.byteArrayToHexWithHeader(writer, abc.bodies.get(bodyIndex).getCode().getBytes()); + Helper.byteArrayToHexWithHeader(writer, abc.bodies.get(bodyIndex).getCodeBytes()); textHexOnly = new HighlightedText(writer); } setText(textHexOnly);