Program: 62071
Project: 62071
Buggy source:
@SuppressWarnings("String_Node_Str") private static boolean readActionListAtPos(List<DisassemblyListener> listeners,List<GraphTargetItem> output,HashMap<Long,List<GraphSourceItemContainer>> containers,long address,long containerSWFOffset,boolean notCompileTime,boolean enableVariables,List<Object> localData,Stack<GraphTargetItem> stack,ConstantPool cpool,SWFInputStream sis,ReReadableInputStream rri,int ip,List<Action> ret,int startIp,int endip,String path) throws IOException {
  boolean debugMode=false;
  boolean decideBranch=false;
  boolean deobfuscate=(Boolean)Configuration.getConfig("String_Node_Str",true);
  boolean retv=false;
  rri.setPos(ip);
  Action a;
  long filePos=rri.getPos();
  Scanner sc=new Scanner(System.in,"String_Node_Str");
  int prevIp=ip;
  while (((endip == -1) || (endip > ip)) && (a=sis.readAction(rri)) != null) {
    for (int i=0; i < listeners.size(); i++) {
      listeners.get(i).progress("String_Node_Str",rri.getCount(),rri.length());
    }
    if ((ip < ret.size()) && (!(ret.get(ip) instanceof ActionNop))) {
      a=ret.get(ip);
      if (a.getAddress() != ip) {
        Logger.getLogger(SWFInputStream.class.getName()).log(Level.SEVERE,"String_Node_Str" + ip + "String_Node_Str"+ a.getASMSource(new ArrayList<GraphSourceItem>(),new ArrayList<Long>(),new ArrayList<String>(),SWF.DEFAULT_VERSION,false));
      }
    }
    a.containerSWFOffset=containerSWFOffset;
    a.setAddress(prevIp,SWF.DEFAULT_VERSION,false);
    int info=a.actionLength + 1 + ((a.actionCode > 0x80) ? 2 : 0);
    byte b[]=a.getBytes(sis.version);
    int infoCorrect=info;
    if ((!(a instanceof ActionStore)) && (!(a instanceof GraphSourceItemContainer))) {
      int change=info - (rri.getPos() - ip);
      if (change > 0) {
        a.afterInsert=new ActionJump(change);
      }
    }
 else {
      info=rri.getPos() - ip;
    }
    if (ip < startIp) {
      retv=true;
    }
    if (a instanceof ActionPush) {
      if (cpool != null) {
        ((ActionPush)a).constantPool=cpool.constants;
        cpool.count++;
      }
    }
    if (a instanceof ActionDefineFunction) {
      if (cpool != null) {
        cpool.count++;
      }
    }
    if (a instanceof ActionDefineFunction2) {
      if (cpool != null) {
        cpool.count++;
      }
    }
    if (debugMode) {
      String atos=a.getASMSource(new ArrayList<GraphSourceItem>(),new ArrayList<Long>(),cpool.constants,sis.version,false);
      if (a instanceof GraphSourceItemContainer) {
        atos=a.toString();
      }
      System.err.println("String_Node_Str" + (ip - startIp) + "String_Node_Str"+ Helper.formatAddress(ip - startIp)+ "String_Node_Str"+ "String_Node_Str"+ a.actionLength+ "String_Node_Str"+ atos+ (a.isIgnored() ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ Helper.stackToString(stack,Helper.toList(cpool))+ "String_Node_Str"+ Helper.byteArrToString(a.getBytes(SWF.DEFAULT_VERSION)));
      @SuppressWarnings("String_Node_Str") HashMap<String,GraphTargetItem> vars=(HashMap<String,GraphTargetItem>)localData.get(1);
      System.err.print("String_Node_Str");
      for (      Entry<String,GraphTargetItem> v : vars.entrySet()) {
        System.err.print("String_Node_Str" + v + "String_Node_Str"+ Highlighting.stripHilights(v.getValue().toString(cpool))+ "String_Node_Str");
      }
      System.err.println();
      String add="String_Node_Str";
      if (a instanceof ActionIf) {
        add="String_Node_Str" + ((ActionIf)a).getJumpOffset();
      }
      if (a instanceof ActionJump) {
        add="String_Node_Str" + ((ActionJump)a).getJumpOffset();
      }
      System.err.println(add);
    }
    long newFilePos=rri.getPos();
    long actionLen=newFilePos - filePos;
    ensureCapacity(ret,ip);
    int newip=-1;
    if (!enableVariables && (!(ret.get(ip) instanceof ActionNop))) {
      break;
    }
    if (a instanceof ActionConstantPool) {
      if (cpool == null) {
        cpool=new ConstantPool();
      }
      cpool.setNew(((ActionConstantPool)a).constantPool);
    }
    ActionIf aif=null;
    boolean goaif=false;
    if (!a.isIgnored()) {
      try {
        if (a instanceof ActionIf) {
          aif=(ActionIf)a;
          GraphTargetItem top=null;
          if (deobfuscate) {
            top=stack.pop();
          }
          int nip=rri.getPos() + aif.getJumpOffset();
          if (decideBranch) {
            System.out.print("String_Node_Str" + nip + "String_Node_Str");
            System.out.print("String_Node_Str");
            String next=sc.next();
            if (next.equals("String_Node_Str")) {
              newip=rri.getPos() + aif.getJumpOffset();
              rri.setPos(newip);
            }
 else             if (next.equals("String_Node_Str")) {
            }
 else             if (next.equals("String_Node_Str")) {
              goaif=true;
            }
          }
 else           if (deobfuscate && top.isCompileTime() && (!top.hasSideEffect())&& ((!top.isVariableComputed()) || (top.isVariableComputed() && enableVariables && (!notCompileTime)))) {
            if (enableVariables) {
              ((ActionIf)a).compileTime=true;
            }
            if (debugMode) {
              System.err.print("String_Node_Str");
            }
            if (EcmaScript.toBoolean(top.getResult())) {
              newip=rri.getPos() + aif.getJumpOffset();
              if (((!enableVariables) || (!top.isVariableComputed())) && (!aif.ignoreUsed)) {
                a=new ActionJump(aif.getJumpOffset());
                a.setAddress(aif.getAddress(),SWF.DEFAULT_VERSION);
              }
              aif.jumpUsed=true;
              if (aif.ignoreUsed) {
                aif.compileTime=false;
              }
              if (debugMode) {
                System.err.println("String_Node_Str");
              }
            }
 else {
              aif.ignoreUsed=true;
              if (aif.jumpUsed) {
                aif.compileTime=false;
              }
              if (debugMode) {
                System.err.println("String_Node_Str");
              }
              if (((!enableVariables) || (!top.isVariableComputed())) && (!aif.jumpUsed)) {
                aif.setIgnored(true,0);
              }
            }
            if (((!enableVariables) || (!top.isVariableComputed())) && (!(aif.jumpUsed && aif.ignoreUsed))) {
              List<GraphSourceItemPos> needed=top.getNeededSources();
              for (              GraphSourceItemPos ig : needed) {
                if (ig.item == null) {
                  continue;
                }
                if (ig.item instanceof ActionPush) {
                  if (!((ActionPush)ig.item).ignoredParts.contains(ig.pos)) {
                    ((ActionPush)ig.item).ignoredParts.add(ig.pos);
                    if (((ActionPush)ig.item).ignoredParts.size() == ((ActionPush)ig.item).values.size()) {
                      ((Action)ig.item).setIgnored(true,0);
                    }
                  }
                }
 else {
                  ((Action)ig.item).setIgnored(true,0);
                }
              }
            }
          }
 else {
            if (debugMode) {
              System.err.println("String_Node_Str");
            }
            goaif=true;
          }
        }
 else         if (a instanceof ActionJump) {
          newip=rri.getPos() + ((ActionJump)a).getJumpOffset();
        }
 else         if (!(a instanceof GraphSourceItemContainer)) {
          if (deobfuscate) {
            if (((a instanceof ActionEquals) || (a instanceof ActionEquals2)) && (stack.size() == 1) && (stack.peek() instanceof DirectValueActionItem)) {
              stack.push(new DirectValueActionItem(null,0,new Null(),new ArrayList<String>()));
            }
            if ((a instanceof ActionStoreRegister) && stack.isEmpty()) {
              stack.push(new DirectValueActionItem(null,0,new Null(),new ArrayList<String>()));
            }
            a.translate(localData,stack,output,Graph.SOP_USE_STATIC,path);
          }
        }
      }
 catch (      RuntimeException ex) {
        if (!enableVariables) {
          throw ex;
        }
        log.log(Level.SEVERE,"String_Node_Str",ex);
        break;
      }
    }
    int nopos=-1;
    for (int i=0; i < actionLen; i++) {
      ensureCapacity(ret,ip + i);
      if (a instanceof ActionNop) {
        int prevPos=(int)a.getAddress();
        a=new ActionNop();
        a.setAddress(prevPos,SWF.DEFAULT_VERSION);
        nopos++;
        if (nopos > 0) {
          a.setAddress(a.getAddress() + 1,SWF.DEFAULT_VERSION);
        }
      }
      ret.set(ip + i,a);
    }
    if (a instanceof GraphSourceItemContainer) {
      GraphSourceItemContainer cnt=(GraphSourceItemContainer)a;
      if (a instanceof Action) {
        long endAddr=a.getAddress() + cnt.getHeaderSize();
        String cntName=cnt.getName();
        List<List<GraphTargetItem>> output2s=new ArrayList<>();
        for (        long size : cnt.getContainerSizes()) {
          if (size == 0) {
            output2s.add(new ArrayList<GraphTargetItem>());
            continue;
          }
          List<Object> localData2=Helper.toList(new HashMap<Integer,String>(),new HashMap<String,GraphTargetItem>(),new HashMap<String,GraphTargetItem>());
          List<GraphTargetItem> output2=new ArrayList<>();
          readActionListAtPos(listeners,output2,containers,address,containerSWFOffset,notCompileTime,enableVariables,localData2,new Stack<GraphTargetItem>(),cpool,sis,rri,(int)endAddr,ret,startIp,(int)(endAddr + size),path + (cntName == null ? "String_Node_Str" : "String_Node_Str" + cntName));
          output2s.add(output2);
          endAddr+=size;
        }
        if (deobfuscate) {
          cnt.translateContainer(output2s,stack,output,(HashMap<Integer,String>)localData.get(0),(HashMap<String,GraphTargetItem>)localData.get(1),(HashMap<String,GraphTargetItem>)localData.get(2));
        }
        ip=(int)endAddr;
        prevIp=ip;
        rri.setPos(ip);
        filePos=rri.getPos();
        continue;
      }
    }
    if (a instanceof ActionEnd) {
      break;
    }
    if (newip > -1) {
      ip=newip;
    }
 else {
      ip=ip + info;
    }
    rri.setPos(ip);
    filePos=rri.getPos();
    if (goaif) {
      if (aif.ignoreUsed && aif.jumpUsed) {
        break;
      }
      aif.ignoreUsed=true;
      aif.jumpUsed=true;
      int oldPos=rri.getPos();
      @SuppressWarnings("String_Node_Str") Stack<GraphTargetItem> substack=(Stack<GraphTargetItem>)stack.clone();
      if (readActionListAtPos(listeners,output,containers,address,containerSWFOffset,true,enableVariables,localData,substack,cpool,sis,rri,rri.getPos() + aif.getJumpOffset(),ret,startIp,endip,path)) {
        retv=true;
      }
      rri.setPos(oldPos);
      notCompileTime=true;
    }
    prevIp=ip;
    if (a.isExit()) {
      break;
    }
  }
  for (  DisassemblyListener listener : listeners) {
    listener.progress("String_Node_Str",rri.getCount(),rri.length());
  }
  return retv;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private static boolean readActionListAtPos(List<DisassemblyListener> listeners,List<GraphTargetItem> output,HashMap<Long,List<GraphSourceItemContainer>> containers,long address,long containerSWFOffset,boolean notCompileTime,boolean enableVariables,List<Object> localData,Stack<GraphTargetItem> stack,ConstantPool cpool,SWFInputStream sis,ReReadableInputStream rri,int ip,List<Action> ret,int startIp,int endip,String path) throws IOException {
  boolean debugMode=false;
  boolean decideBranch=false;
  boolean deobfuscate=(Boolean)Configuration.getConfig("String_Node_Str",true);
  boolean retv=false;
  rri.setPos(ip);
  Action a;
  long filePos=rri.getPos();
  Scanner sc=new Scanner(System.in,"String_Node_Str");
  int prevIp=ip;
  while (((endip == -1) || (endip > ip)) && (a=sis.readAction(rri)) != null) {
    for (int i=0; i < listeners.size(); i++) {
      listeners.get(i).progress("String_Node_Str",rri.getCount(),rri.length());
    }
    if ((ip < ret.size()) && (!(ret.get(ip) instanceof ActionNop))) {
      a=ret.get(ip);
      if (a.getAddress() != ip) {
        Logger.getLogger(SWFInputStream.class.getName()).log(Level.SEVERE,"String_Node_Str" + ip + "String_Node_Str"+ a.getASMSource(new ArrayList<GraphSourceItem>(),new ArrayList<Long>(),new ArrayList<String>(),SWF.DEFAULT_VERSION,false));
      }
    }
    a.containerSWFOffset=containerSWFOffset;
    a.setAddress(prevIp,SWF.DEFAULT_VERSION,false);
    int info=a.actionLength + 1 + ((a.actionCode > 0x80) ? 2 : 0);
    byte b[]=a.getBytes(sis.version);
    int infoCorrect=info;
    if ((!(a instanceof ActionStore)) && (!(a instanceof GraphSourceItemContainer))) {
      int change=info - (rri.getPos() - ip);
      if (change > 0) {
        a.afterInsert=new ActionJump(change);
      }
    }
 else {
      info=rri.getPos() - ip;
    }
    if (ip < startIp) {
      retv=true;
    }
    if (a instanceof ActionPush) {
      if (cpool != null) {
        ((ActionPush)a).constantPool=cpool.constants;
        cpool.count++;
      }
    }
    if (a instanceof ActionDefineFunction) {
      if (cpool != null) {
        cpool.count++;
      }
    }
    if (a instanceof ActionDefineFunction2) {
      if (cpool != null) {
        cpool.count++;
      }
    }
    if (debugMode) {
      String atos=a.getASMSource(new ArrayList<GraphSourceItem>(),new ArrayList<Long>(),cpool.constants,sis.version,false);
      if (a instanceof GraphSourceItemContainer) {
        atos=a.toString();
      }
      System.err.println("String_Node_Str" + (ip - startIp) + "String_Node_Str"+ Helper.formatAddress(ip - startIp)+ "String_Node_Str"+ "String_Node_Str"+ a.actionLength+ "String_Node_Str"+ atos+ (a.isIgnored() ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ Helper.stackToString(stack,Helper.toList(cpool))+ "String_Node_Str"+ Helper.byteArrToString(a.getBytes(SWF.DEFAULT_VERSION)));
      @SuppressWarnings("String_Node_Str") HashMap<String,GraphTargetItem> vars=(HashMap<String,GraphTargetItem>)localData.get(1);
      System.err.print("String_Node_Str");
      for (      Entry<String,GraphTargetItem> v : vars.entrySet()) {
        System.err.print("String_Node_Str" + v + "String_Node_Str"+ Highlighting.stripHilights(v.getValue().toString(cpool))+ "String_Node_Str");
      }
      System.err.println();
      String add="String_Node_Str";
      if (a instanceof ActionIf) {
        add="String_Node_Str" + ((ActionIf)a).getJumpOffset();
      }
      if (a instanceof ActionJump) {
        add="String_Node_Str" + ((ActionJump)a).getJumpOffset();
      }
      System.err.println(add);
    }
    long newFilePos=rri.getPos();
    long actionLen=newFilePos - filePos;
    ensureCapacity(ret,ip);
    int newip=-1;
    if (!enableVariables && (!(ret.get(ip) instanceof ActionNop))) {
      break;
    }
    if (a instanceof ActionConstantPool) {
      if (cpool == null) {
        cpool=new ConstantPool();
      }
      cpool.setNew(((ActionConstantPool)a).constantPool);
    }
    ActionIf aif=null;
    boolean goaif=false;
    if (!a.isIgnored()) {
      try {
        if (a instanceof ActionIf) {
          aif=(ActionIf)a;
          GraphTargetItem top=null;
          if (deobfuscate) {
            top=stack.pop();
          }
          int nip=rri.getPos() + aif.getJumpOffset();
          if (decideBranch) {
            System.out.print("String_Node_Str" + nip + "String_Node_Str");
            System.out.print("String_Node_Str");
            String next=sc.next();
            if (next.equals("String_Node_Str")) {
              newip=rri.getPos() + aif.getJumpOffset();
              rri.setPos(newip);
            }
 else             if (next.equals("String_Node_Str")) {
            }
 else             if (next.equals("String_Node_Str")) {
              goaif=true;
            }
          }
 else           if (deobfuscate && top.isCompileTime() && (!top.hasSideEffect())&& ((!top.isVariableComputed()) || (top.isVariableComputed() && enableVariables && (!notCompileTime)))) {
            if (enableVariables) {
              ((ActionIf)a).compileTime=true;
            }
            if (debugMode) {
              System.err.print("String_Node_Str");
            }
            if (EcmaScript.toBoolean(top.getResult())) {
              newip=rri.getPos() + aif.getJumpOffset();
              if (((!enableVariables) || (!top.isVariableComputed())) && (!aif.ignoreUsed)) {
                a=new ActionJump(aif.getJumpOffset());
                a.setAddress(aif.getAddress(),SWF.DEFAULT_VERSION);
              }
              aif.jumpUsed=true;
              if (aif.ignoreUsed) {
                aif.compileTime=false;
              }
              if (debugMode) {
                System.err.println("String_Node_Str");
              }
            }
 else {
              aif.ignoreUsed=true;
              if (aif.jumpUsed) {
                aif.compileTime=false;
              }
              if (debugMode) {
                System.err.println("String_Node_Str");
              }
              if (((!enableVariables) || (!top.isVariableComputed())) && (!aif.jumpUsed)) {
                aif.setIgnored(true,0);
              }
            }
            if (((!enableVariables) || (!top.isVariableComputed())) && (!(aif.jumpUsed && aif.ignoreUsed))) {
              List<GraphSourceItemPos> needed=top.getNeededSources();
              for (              GraphSourceItemPos ig : needed) {
                if (ig.item == null) {
                  continue;
                }
                if (ig.item instanceof ActionPush) {
                  if (!((ActionPush)ig.item).ignoredParts.contains(ig.pos)) {
                    ((ActionPush)ig.item).ignoredParts.add(ig.pos);
                    if (((ActionPush)ig.item).ignoredParts.size() == ((ActionPush)ig.item).values.size()) {
                      ((Action)ig.item).setIgnored(true,0);
                    }
                  }
                }
 else {
                  ((Action)ig.item).setIgnored(true,0);
                }
              }
            }
          }
 else {
            if (debugMode) {
              System.err.println("String_Node_Str");
            }
            goaif=true;
          }
        }
 else         if (a instanceof ActionJump) {
          newip=rri.getPos() + ((ActionJump)a).getJumpOffset();
        }
 else         if (!(a instanceof GraphSourceItemContainer)) {
          if (deobfuscate) {
            if (((a instanceof ActionEquals) || (a instanceof ActionEquals2)) && (stack.size() == 1) && (stack.peek() instanceof DirectValueActionItem)) {
              stack.push(new DirectValueActionItem(null,0,new Null(),new ArrayList<String>()));
            }
            if ((a instanceof ActionStoreRegister) && stack.isEmpty()) {
              stack.push(new DirectValueActionItem(null,0,new Null(),new ArrayList<String>()));
            }
            List<Object> localData2=(List<Object>)Helper.deepCopy(localData);
            HashMap<String,GraphTargetItem> vars=(HashMap<String,GraphTargetItem>)localData.get(1);
            for (int r=0; r < 256; r++) {
              if (vars.containsKey("String_Node_Str" + r)) {
                vars.remove("String_Node_Str" + r);
              }
            }
            a.translate(localData2,stack,output,Graph.SOP_USE_STATIC,path);
          }
        }
      }
 catch (      RuntimeException ex) {
        if (!enableVariables) {
          throw ex;
        }
        log.log(Level.SEVERE,"String_Node_Str",ex);
        break;
      }
    }
    int nopos=-1;
    for (int i=0; i < actionLen; i++) {
      ensureCapacity(ret,ip + i);
      if (a instanceof ActionNop) {
        int prevPos=(int)a.getAddress();
        a=new ActionNop();
        a.setAddress(prevPos,SWF.DEFAULT_VERSION);
        nopos++;
        if (nopos > 0) {
          a.setAddress(a.getAddress() + 1,SWF.DEFAULT_VERSION);
        }
      }
      ret.set(ip + i,a);
    }
    if (a instanceof GraphSourceItemContainer) {
      GraphSourceItemContainer cnt=(GraphSourceItemContainer)a;
      if (a instanceof Action) {
        long endAddr=a.getAddress() + cnt.getHeaderSize();
        String cntName=cnt.getName();
        List<List<GraphTargetItem>> output2s=new ArrayList<>();
        for (        long size : cnt.getContainerSizes()) {
          if (size == 0) {
            output2s.add(new ArrayList<GraphTargetItem>());
            continue;
          }
          List<Object> localData2=Helper.toList(new HashMap<Integer,String>(),new HashMap<String,GraphTargetItem>(),new HashMap<String,GraphTargetItem>());
          List<GraphTargetItem> output2=new ArrayList<>();
          readActionListAtPos(listeners,output2,containers,address,containerSWFOffset,notCompileTime,enableVariables,localData2,new Stack<GraphTargetItem>(),cpool,sis,rri,(int)endAddr,ret,startIp,(int)(endAddr + size),path + (cntName == null ? "String_Node_Str" : "String_Node_Str" + cntName));
          output2s.add(output2);
          endAddr+=size;
        }
        if (deobfuscate) {
          cnt.translateContainer(output2s,stack,output,(HashMap<Integer,String>)localData.get(0),(HashMap<String,GraphTargetItem>)localData.get(1),(HashMap<String,GraphTargetItem>)localData.get(2));
        }
        ip=(int)endAddr;
        prevIp=ip;
        rri.setPos(ip);
        filePos=rri.getPos();
        continue;
      }
    }
    if (a instanceof ActionEnd) {
      break;
    }
    if (newip > -1) {
      ip=newip;
    }
 else {
      ip=ip + info;
    }
    rri.setPos(ip);
    filePos=rri.getPos();
    if (goaif) {
      if (aif.ignoreUsed && aif.jumpUsed) {
        break;
      }
      aif.ignoreUsed=true;
      aif.jumpUsed=true;
      int oldPos=rri.getPos();
      @SuppressWarnings("String_Node_Str") Stack<GraphTargetItem> substack=(Stack<GraphTargetItem>)stack.clone();
      if (readActionListAtPos(listeners,output,containers,address,containerSWFOffset,true,enableVariables,localData,substack,cpool,sis,rri,rri.getPos() + aif.getJumpOffset(),ret,startIp,endip,path)) {
        retv=true;
      }
      rri.setPos(oldPos);
      notCompileTime=true;
    }
    prevIp=ip;
    if (a.isExit()) {
      break;
    }
  }
  for (  DisassemblyListener listener : listeners) {
    listener.progress("String_Node_Str",rri.getCount(),rri.length());
  }
  return retv;
}