Issue #896 AS3 methodinfo deletion fix

AS3 deobfuscation improved (obfuscated stack values ignored)
This commit is contained in:
Jindra Petřík
2015-05-30 07:43:07 +02:00
parent 58c24aa746
commit e49dc85db6
2 changed files with 21 additions and 2 deletions

View File

@@ -12,10 +12,21 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PopIns;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.ScopeStack;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.HashMap;
import java.util.List;
/**
*
@@ -26,4 +37,10 @@ public class DeobfuscatePopIns extends PopIns {
public DeobfuscatePopIns() {
instructionName = "ffdec_deobfuscatepop";
}
@Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
stack.pop(); //Just ignore the value
}
}

View File

@@ -41,7 +41,9 @@ public class MethodInfo {
if (body != null) {
for (AVM2Instruction ins : body.getCode().code) {
if (ins.definition instanceof NewFunctionIns) {
abc.method_info.get(ins.operands[0]).delete(abc, d);
if (ins.operands[0] < abc.method_info.size() && !abc.method_info.get(ins.operands[0]).deleted) {
abc.method_info.get(ins.operands[0]).delete(abc, d);
}
}
}
}