diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/EnableDebugger2Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/EnableDebugger2Tag.java index db8e9b36b..41302edf5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/EnableDebugger2Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/EnableDebugger2Tag.java @@ -73,8 +73,16 @@ public class EnableDebugger2Tag extends Tag implements PasswordTag { @Override public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException { - reserved = sis.readUI16("reserved"); - passwordHash = sis.readString("passwordHash"); + if (sis.available() > 0) { + reserved = sis.readUI16("reserved"); + } else { + reserved = 0; + } + if (sis.available() > 0) { + passwordHash = sis.readString("passwordHash"); + } else { + passwordHash = null; + } } /** @@ -86,7 +94,9 @@ public class EnableDebugger2Tag extends Tag implements PasswordTag { @Override public void getData(SWFOutputStream sos) throws IOException { sos.writeUI16(reserved); - sos.writeString(passwordHash); + if (passwordHash != null) { + sos.writeString(passwordHash); + } } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/EnableDebuggerTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/EnableDebuggerTag.java index 68fc5541d..c72f4fec1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/EnableDebuggerTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/EnableDebuggerTag.java @@ -20,7 +20,10 @@ import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.tags.base.PasswordTag; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.annotations.Password; +import com.jpexs.decompiler.flash.types.annotations.Reserved; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.ByteArrayRange; import com.jpexs.helpers.MD5Crypt; import java.io.IOException; @@ -36,6 +39,10 @@ public class EnableDebuggerTag extends Tag implements PasswordTag { public static final String NAME = "EnableDebugger"; + @Reserved + @SWFType(BasicType.UI16) + public int reserved; + /** * MD5 hash of password */ @@ -49,6 +56,7 @@ public class EnableDebuggerTag extends Tag implements PasswordTag { */ public EnableDebuggerTag(SWF swf) { super(swf, ID, NAME, null); + reserved = 0; setPassword(""); } @@ -66,7 +74,16 @@ public class EnableDebuggerTag extends Tag implements PasswordTag { @Override public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException { - passwordHash = sis.readString("passwordHash"); + if (sis.available() > 0) { + reserved = sis.readUI16("reserved"); + } else { + reserved = 0; + } + if (sis.available() > 0) { + passwordHash = sis.readString("passwordHash"); + } else { + passwordHash = null; + } } /** @@ -77,6 +94,7 @@ public class EnableDebuggerTag extends Tag implements PasswordTag { */ @Override public void getData(SWFOutputStream sos) throws IOException { + sos.writeUI16(reserved); if (passwordHash != null) { sos.writeString(passwordHash); } @@ -84,7 +102,6 @@ public class EnableDebuggerTag extends Tag implements PasswordTag { @Override public void setPassword(String password) { - //Assuming EnableDebugger tag has same hash type as EnableDebugger2 this.passwordHash = MD5Crypt.crypt(password, 2); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/ProtectTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/ProtectTag.java index 791caeb8d..eb97423a6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/ProtectTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/ProtectTag.java @@ -20,7 +20,10 @@ import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.tags.base.PasswordTag; +import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.annotations.Password; +import com.jpexs.decompiler.flash.types.annotations.Reserved; +import com.jpexs.decompiler.flash.types.annotations.SWFType; import com.jpexs.helpers.ByteArrayRange; import com.jpexs.helpers.MD5Crypt; import java.io.IOException; @@ -36,6 +39,10 @@ public class ProtectTag extends Tag implements PasswordTag { public static final String NAME = "Protect"; + @Reserved + @SWFType(BasicType.UI16) + public int reserved; + /** * MD5 hash of password */ @@ -50,6 +57,7 @@ public class ProtectTag extends Tag implements PasswordTag { public ProtectTag(SWF swf) { super(swf, ID, NAME, null); passwordHash = ""; + reserved = 0; } /** @@ -66,6 +74,9 @@ public class ProtectTag extends Tag implements PasswordTag { @Override public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException { + if (sis.available() > 0) { + reserved = sis.readUI16("reserved"); + } if (sis.available() > 0) { passwordHash = sis.readString("passwordHash"); } else { @@ -81,6 +92,7 @@ public class ProtectTag extends Tag implements PasswordTag { */ @Override public void getData(SWFOutputStream sos) throws IOException { + sos.writeUI16(reserved); if (!"".equals(passwordHash)) { sos.writeString(passwordHash); }