using fake DeobfuscateJump action when jump tag is added automatically during actiondata parsing (this action not exists in the steam)

This commit is contained in:
honfika
2014-08-17 17:58:57 +02:00
parent 98349f145d
commit 083c4f2ffc
4 changed files with 62 additions and 12 deletions

View File

@@ -1169,7 +1169,7 @@ public class SWFInputStream implements AutoCloseable {
case 15:
ret = new StartSoundTag(sis, data);
break;
//case 16:
//case 16: StopSound
case 17:
ret = new DefineButtonSoundTag(sis, data);
break;
@@ -1179,12 +1179,12 @@ public class SWFInputStream implements AutoCloseable {
case 19:
ret = new SoundStreamBlockTag(sis, data);
break;
case 21:
ret = new DefineBitsJPEG2Tag(sis, data);
break;
case 20:
ret = new DefineBitsLosslessTag(sis, data);
break;
case 21:
ret = new DefineBitsJPEG2Tag(sis, data);
break;
case 22:
ret = new DefineShape2Tag(sis, data);
break;
@@ -1235,7 +1235,7 @@ public class SWFInputStream implements AutoCloseable {
case 43:
ret = new FrameLabelTag(sis, data);
break;
//case 44:
//case 44: DefineBehavior
case 45:
ret = new SoundStreamHead2Tag(sis, data);
break;
@@ -1250,7 +1250,9 @@ public class SWFInputStream implements AutoCloseable {
//case 50: DefineCommandObject
//case 51: CharacterSet
//case 52: ExternalFont
//case 53-55
//case 53: DefineFunction
//case 54: PlaceFunction
//case 55: GenTagObject
case 56:
ret = new ExportAssetsTag(sis, data);
break;
@@ -1284,7 +1286,8 @@ public class SWFInputStream implements AutoCloseable {
case 66:
ret = new SetTabIndexTag(sis, data);
break;
//case 67-68:
//case 67: DefineShape4 ???
//case 68: DefineMorphShape2 ???
case 69:
ret = new FileAttributesTag(sis, data);
break;

View File

@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.DisassemblyListener;
import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.action.model.ConstantPool;
import com.jpexs.decompiler.flash.action.model.DirectValueActionItem;
import com.jpexs.decompiler.flash.action.special.ActionDeobfuscateJump;
import com.jpexs.decompiler.flash.action.special.ActionEnd;
import com.jpexs.decompiler.flash.action.special.ActionNop;
import com.jpexs.decompiler.flash.action.special.ActionStore;
@@ -145,7 +146,7 @@ public class ActionListReader {
// jump to the entry action when it is diffrent from the first action in the map
long index = addresses.get(0);
if (index != -1 && entryAction != actionMap.get(index)) {
ActionJump jump = new ActionJump(0);
ActionJump jump = new ActionDeobfuscateJump(0);
int size = jump.getTotalActionLength();
jump.setJumpOffset((int) (entryAction.getAddress() - size));
actions.add(jump);
@@ -160,7 +161,7 @@ public class ActionListReader {
actions.add(action);
if (nextIndex != -1 && nextOffset != nextIndex) {
if (!action.isExit() && !(action instanceof ActionJump)) {
ActionJump jump = new ActionJump(0);
ActionJump jump = new ActionDeobfuscateJump(0);
jump.setAddress(action.getAddress());
int size = jump.getTotalActionLength();
jump.setJumpOffset((int) (nextOffset - action.getAddress() - size));
@@ -388,7 +389,7 @@ public class ActionListReader {
int length = a.getBytes(version).length;
if ((i != actions.size() - 1) && (a instanceof ActionEnd)) {
// placeholder for jump action
length = new ActionJump(0).getTotalActionLength();
length = new ActionDeobfuscateJump(0).getTotalActionLength();
}
address += length;
}
@@ -469,7 +470,7 @@ public class ActionListReader {
for (int i = 0; i < actions.size(); i++) {
Action a = actions.get(i);
if ((i != actions.size() - 1) && (a instanceof ActionEnd)) {
ActionJump aJump = new ActionJump(0);
ActionJump aJump = new ActionDeobfuscateJump(0);
aJump.setJumpOffset((int) (endAddress - a.getAddress() - aJump.getTotalActionLength()));
aJump.setAddress(a.getAddress());
replaceJumpTargets(jumps, a, aJump);
@@ -614,7 +615,7 @@ public class ActionListReader {
// unknown action, replace with jump
if (a instanceof ActionNop) {
ActionJump aJump = new ActionJump(0);
ActionJump aJump = new ActionDeobfuscateJump(0);
int jumpLength = aJump.getTotalActionLength();
aJump.setAddress(a.getAddress());
aJump.setJumpOffset(actionLengthWithHeader - jumpLength);

View File

@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.action.Action;
import com.jpexs.decompiler.flash.action.flashlite.ActionFSCommand2;
import com.jpexs.decompiler.flash.action.flashlite.ActionStrictMode;
import com.jpexs.decompiler.flash.action.parser.ParseException;
import com.jpexs.decompiler.flash.action.special.ActionDeobfuscateJump;
import com.jpexs.decompiler.flash.action.special.ActionDeobfuscatePop;
import com.jpexs.decompiler.flash.action.special.ActionNop;
import com.jpexs.decompiler.flash.action.swf3.ActionGetURL;
@@ -408,6 +409,8 @@ public class ASMParser {
a = (new ActionNop());
} else if (instructionName.compareToIgnoreCase("FFDec_DeobfuscatePop") == 0) {
a = (new ActionDeobfuscatePop());
} else if (instructionName.compareToIgnoreCase("FFDec_DeobfuscateJump") == 0) {
a = (new ActionDeobfuscateJump(lexer));
} else {
throw new ParseException("Unknown instruction name :" + instructionName, lexer.yyline());
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright (C) 2010-2014 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.action.special;
import com.jpexs.decompiler.flash.action.parser.ParseException;
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
import com.jpexs.decompiler.flash.action.swf4.ActionJump;
import java.io.IOException;
/**
*
* @author JPEXS
*/
public class ActionDeobfuscateJump extends ActionJump {
public ActionDeobfuscateJump(int offset) {
super(2);
}
public ActionDeobfuscateJump(FlasmLexer lexer) throws IOException, ParseException {
super(lexer);
}
@Override
public String toString() {
return "FFDec_DeobfuscateJump " + getJumpOffset();
}
}