Skip to content
Permalink
Browse files

avoid throwing EmptyStackExceptions in as2 deobfuscation

  • Loading branch information
honfika committed Aug 26, 2015
1 parent 5465043 commit 696ee04cb41cb37467933724687c25bfd4328ae8
Showing with 1,453 additions and 471 deletions.
  1. +9 −0 ffdec-findbugs-config.fbp
  2. +7 −0 ...rc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorRegisters.java
  3. +20 −0 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java
  4. +19 −0 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java
  5. +23 −3 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/deobfuscation/ActionDeobfuscator.java
  6. +10 −0 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/deobfuscation/ActionDeobfuscatorSimple.java
  7. +21 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/flashlite/ActionFSCommand2.java
  8. +7 −5 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/special/ActionDeobfuscatePop.java
  9. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionAdd.java
  10. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionAnd.java
  11. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionAsciiToChar.java
  12. +11 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionCall.java
  13. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionCharToAscii.java
  14. +11 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionCloneSprite.java
  15. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionDivide.java
  16. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionEquals.java
  17. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionGetProperty.java
  18. +11 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionGetTime.java
  19. +6 −0 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionGetURL2.java
  20. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionGetVariable.java
  21. +6 −0 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionGotoFrame2.java
  22. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionLess.java
  23. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionMBAsciiToChar.java
  24. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionMBCharToAscii.java
  25. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionMBStringExtract.java
  26. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionMBStringLength.java
  27. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionMultiply.java
  28. +11 −0 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionNot.java
  29. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionOr.java
  30. +6 −0 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPop.java
  31. +6 −0 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java
  32. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionRandomNumber.java
  33. +11 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionRemoveSprite.java
  34. +19 −16 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionSetProperty.java
  35. +11 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionSetTarget2.java
  36. +19 −16 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionSetVariable.java
  37. +26 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionStartDrag.java
  38. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionStringAdd.java
  39. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionStringEquals.java
  40. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionStringExtract.java
  41. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionStringLength.java
  42. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionStringLess.java
  43. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionSubtract.java
  44. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionToInteger.java
  45. +11 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionTrace.java
  46. +6 −0 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionWaitForFrame2.java
  47. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionAdd2.java
  48. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitAnd.java
  49. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitLShift.java
  50. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitOr.java
  51. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitRShift.java
  52. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitURShift.java
  53. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionBitXor.java
  54. +21 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionCallFunction.java
  55. +21 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionCallMethod.java
  56. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionDecrement.java
  57. +11 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineLocal.java
  58. +11 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineLocal2.java
  59. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionDelete.java
  60. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionDelete2.java
  61. +6 −0 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionEnumerate.java
  62. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionEquals2.java
  63. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionGetMember.java
  64. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionIncrement.java
  65. +21 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionInitArray.java
  66. +21 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionInitObject.java
  67. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionLess2.java
  68. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionModulo.java
  69. +21 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionNewMethod.java
  70. +21 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionNewObject.java
  71. +11 −0 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionPushDuplicate.java
  72. +11 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionReturn.java
  73. +19 −16 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionSetMember.java
  74. +11 −0 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionStackSwap.java
  75. +21 −14 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionStoreRegister.java
  76. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionTargetPath.java
  77. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionToNumber.java
  78. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionToString.java
  79. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionTypeOf.java
  80. +9 −3 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf6/ActionEnumerate2.java
  81. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf6/ActionGreater.java
  82. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf6/ActionInstanceOf.java
  83. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf6/ActionStrictEquals.java
  84. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf6/ActionStringGreater.java
  85. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf7/ActionCastOp.java
  86. +11 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf7/ActionExtends.java
  87. +16 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf7/ActionImplementsOp.java
  88. +11 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf7/ActionThrow.java
  89. +4 −0 libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphSourceItem.java
  90. +12 −0 libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java
  91. +10 −0 libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TranslateStack.java
  92. +1 −1 src/com/jpexs/browsers/cache/chrome/EntryStore.java
  93. +3 −3 src/com/jpexs/decompiler/flash/gui/FontEmbedDialog.java
  94. +4 −4 src/com/jpexs/decompiler/flash/gui/GenericTagPanel.java
  95. +10 −10 src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java
  96. +52 −55 src/com/jpexs/decompiler/flash/gui/ImagePanel.java
  97. +3 −4 src/com/jpexs/decompiler/flash/gui/LoadingPanel.java
  98. +2 −4 src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java
  99. +16 −15 src/com/jpexs/decompiler/flash/gui/MainPanel.java
  100. +1 −1 src/com/jpexs/decompiler/flash/gui/MyRibbonApplicationMenuButtonUI.java
  101. +11 −17 src/com/jpexs/decompiler/flash/gui/PreviewPanel.java
  102. +0 −2 src/com/jpexs/decompiler/flash/gui/controls/JRepeatButton.java
  103. +6 −6 src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java
  104. +5 −8 src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java
@@ -0,0 +1,9 @@
<Project projectName="JPEXS">
<Jar>.\dist\ffdec.jar</Jar>
<AuxClasspathEntry>.\dist\lib</AuxClasspathEntry>
<SrcDir>.\src</SrcDir>
<SrcDir>.\libsrc</SrcDir>
<SuppressionFilter>
<LastVersion value="-1" relOp="NEQ"/>
</SuppressionFilter>
</Project>
@@ -175,6 +175,7 @@ private int visitCode(Reference<AVM2Instruction> assignment, Set<Integer> visite
toVisit.add(idx);
List<TranslateStack> toVisitStacks = new ArrayList<>();
toVisitStacks.add(stack);
outer:
while (!toVisit.isEmpty()) {
idx = toVisit.remove(0);
stack = toVisitStacks.remove(0);
@@ -192,6 +193,12 @@ private int visitCode(Reference<AVM2Instruction> assignment, Set<Integer> visite
InstructionDefinition def = ins.definition;
//System.err.println("" + idx + ": " + ins + " stack:" + stack.size());

// do not throw EmptyStackException, much faster
int requiredStackSize = ins.getStackPopCount(localData);
if (stack.size() < requiredStackSize) {
continue outer;
}

ins.translate(localData, stack, output, Graph.SOP_USE_STATIC, "");

//if (!(def instanceof KillIns))
@@ -331,19 +331,39 @@ public String toStringNoAddress(AVM2ConstantPool constants, List<DottedChain> fu
@Override
public void translate(BaseLocalData localData, TranslateStack stack, List<GraphTargetItem> output, int staticOperation, String path) throws InterruptedException {
AVM2LocalData aLocalData = (AVM2LocalData) localData;
//int expectedSize = stack.size() - getStackPopCount(localData, stack) + getStackPushCount(localData, stack);
definition.translate(aLocalData.isStatic,
aLocalData.scriptIndex,
aLocalData.classIndex,
aLocalData.localRegs,
stack,
aLocalData.scopeStack,
aLocalData.constants, this, aLocalData.methodInfo, output, aLocalData.methodBody, aLocalData.abc, aLocalData.localRegNames, aLocalData.fullyQualifiedNames, null, aLocalData.localRegAssignmentIps, aLocalData.ip, aLocalData.refs, aLocalData.code);
/*if (stack.size() != expectedSize) {
throw new Error("HONFIKA stack size mismatch");
}*/
}

@Override
public int getStackPopCount(BaseLocalData localData, TranslateStack stack) {
AVM2LocalData aLocalData = (AVM2LocalData) localData;
return getStackPopCount(aLocalData);
}

@Override
public int getStackPushCount(BaseLocalData localData, TranslateStack stack) {
AVM2LocalData aLocalData = (AVM2LocalData) localData;
return getStackPushCount(aLocalData);
}

public int getStackPopCount(AVM2LocalData aLocalData) {
return definition.getStackPopCount(this, aLocalData.abc);
}

public int getStackPushCount(AVM2LocalData aLocalData) {
return definition.getStackPushCount(this, aLocalData.abc);
}

@Override
public boolean isJump() {
return (definition instanceof JumpIns) || (fixedBranch > -1);
@@ -711,6 +711,16 @@ public String getASMSource(ActionList container, Set<Long> knownAddreses, Script
public void translate(TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) throws InterruptedException {
}

@Override
public int getStackPopCount(BaseLocalData localData, TranslateStack stack) {
return 0;
}

@Override
public int getStackPushCount(BaseLocalData localData, TranslateStack stack) {
return 0;
}

/**
* Pops long value off the stack
*
@@ -870,7 +880,16 @@ public static void actionsToSource(final ASMSource asm, final List<Action> actio
@Override
public void translate(BaseLocalData localData, TranslateStack stack, List<GraphTargetItem> output, int staticOperation, String path) throws InterruptedException {
ActionLocalData aLocalData = (ActionLocalData) localData;
/*int expectedSize = stack.size() - getStackPopCount(localData, stack);
if (expectedSize < 0) {
expectedSize = 0;
}
expectedSize += getStackPushCount(localData, stack);*/

translate(stack, output, aLocalData.regNames, aLocalData.variables, aLocalData.functions, staticOperation, path);
/*if (stack.size() != expectedSize && !(this instanceof ActionPushDuplicate)) {
throw new Error("HONFIKA stack size mismatch");
}*/
}

@Override
@@ -257,20 +257,30 @@ private void executeActions(ActionList actions, int idx, int endIdx, ActionConst
}

if (action instanceof ActionDefineLocal) {
GraphTargetItem top = stack.pop();
String variableName = stack.peek().getResult().toString();
if (stack.size() < 2) {
return;
}

String variableName = stack.peek(2).getResult().toString();
result.defines.add(variableName);
stack.push(top);
}

if (action instanceof ActionGetVariable) {
if (stack.isEmpty()) {
return;
}

String variableName = stack.peek().getResult().toString();
if (!localData.variables.containsKey(variableName)) {
break;
}
}

if (action instanceof ActionCallFunction) {
if (stack.isEmpty()) {
return;
}

String functionName = stack.pop().getResult().toString();
long numArgs = EcmaScript.toUint32(stack.pop().getResult());
if (numArgs == 0) {
@@ -283,6 +293,12 @@ private void executeActions(ActionList actions, int idx, int endIdx, ActionConst
break;
}
} else {
// do not throw EmptyStackException, much faster
int requiredStackSize = action.getStackPopCount(localData, stack);
if (stack.size() < requiredStackSize) {
return;
}

action.translate(localData, stack, output, Graph.SOP_USE_STATIC, "");
}

@@ -348,6 +364,10 @@ private void executeActions(ActionList actions, int idx, int endIdx, ActionConst

if (action instanceof ActionIf) {
ActionIf aif = (ActionIf) action;
if (stack.isEmpty()) {
return;
}

if (EcmaScript.toBoolean(stack.pop().getResult())) {
long address = aif.getAddress() + aif.getTotalActionLength() + aif.getJumpOffset();
idx = actions.indexOf(actions.getByAddress(address));
@@ -291,6 +291,12 @@ private void executeActions(ActionList actions, int idx, int endIdx, ExecutionRe
System.out.print(" '" + stack.get(j).getResult() + "'");
}
System.out.println();*/
// do not throw EmptyStackException, much faster
int requiredStackSize = action.getStackPopCount(localData, stack);
if (stack.size() < requiredStackSize) {
return;
}

action.translate(localData, stack, output, Graph.SOP_USE_STATIC, "");

if (!(action instanceof ActionPush
@@ -341,6 +347,10 @@ private void executeActions(ActionList actions, int idx, int endIdx, ExecutionRe

if (action instanceof ActionIf) {
ActionIf aif = (ActionIf) action;
if (stack.isEmpty()) {
return;
}

if (EcmaScript.toBoolean(stack.pop().getResult())) {
long address = aif.getAddress() + aif.getTotalActionLength() + aif.getJumpOffset();
idx = actions.indexOf(actions.getByAddress(address));
@@ -1,20 +1,22 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library 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
* 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.action.flashlite;

import com.jpexs.decompiler.flash.BaseLocalData;
import com.jpexs.decompiler.flash.action.Action;
import com.jpexs.decompiler.flash.action.model.FSCommand2ActionItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
@@ -44,4 +46,19 @@ public void translate(TranslateStack stack, List<GraphTargetItem> output, HashMa
}
stack.push(new FSCommand2ActionItem(this, command, args));
}

@Override
public int getStackPopCount(BaseLocalData localData, TranslateStack stack) {
int result = 2;
if (!stack.isEmpty()) {
result += stack.peek().getAsLong();
}

return result;
}

@Override
public int getStackPushCount(BaseLocalData localData, TranslateStack stack) {
return 1;
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library 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
* 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.action.special;

import com.jpexs.decompiler.flash.BaseLocalData;
@@ -40,7 +41,8 @@ public void translate(BaseLocalData localData, TranslateStack stack, List<GraphT
if (stack.isEmpty()) {
return;
}
GraphTargetItem val = stack.pop();

stack.pop(); //Just ignore the value
}

@Override
@@ -1,20 +1,22 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library 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
* 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.action.swf4;

import com.jpexs.decompiler.flash.BaseLocalData;
import com.jpexs.decompiler.flash.action.Action;
import com.jpexs.decompiler.flash.action.model.operations.AddActionItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
@@ -39,4 +41,14 @@ public void translate(TranslateStack stack, List<GraphTargetItem> output, HashMa
GraphTargetItem b = stack.pop();
stack.push(new AddActionItem(this, b, a, false));
}

@Override
public int getStackPopCount(BaseLocalData localData, TranslateStack stack) {
return 2;
}

@Override
public int getStackPushCount(BaseLocalData localData, TranslateStack stack) {
return 1;
}
}
@@ -1,20 +1,22 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library 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
* 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.action.swf4;

import com.jpexs.decompiler.flash.BaseLocalData;
import com.jpexs.decompiler.flash.action.Action;
import com.jpexs.decompiler.flash.action.model.operations.AndActionItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
@@ -39,4 +41,14 @@ public void translate(TranslateStack stack, List<GraphTargetItem> output, HashMa
GraphTargetItem b = stack.pop();
stack.push(new AndActionItem(this, b, a));
}

@Override
public int getStackPopCount(BaseLocalData localData, TranslateStack stack) {
return 2;
}

@Override
public int getStackPushCount(BaseLocalData localData, TranslateStack stack) {
return 1;
}
}
@@ -1,20 +1,22 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library 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
* 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.action.swf4;

import com.jpexs.decompiler.flash.BaseLocalData;
import com.jpexs.decompiler.flash.action.Action;
import com.jpexs.decompiler.flash.action.model.AsciiToCharActionItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
@@ -38,4 +40,14 @@ public void translate(TranslateStack stack, List<GraphTargetItem> output, HashMa
GraphTargetItem a = stack.pop();
stack.push(new AsciiToCharActionItem(this, a));
}

@Override
public int getStackPopCount(BaseLocalData localData, TranslateStack stack) {
return 1;
}

@Override
public int getStackPushCount(BaseLocalData localData, TranslateStack stack) {
return 1;
}
}

0 comments on commit 696ee04

Please sign in to comment.
You can’t perform that action at this time.