Program: 186864
Project: 186864
Buggy source:
private void doInvoke(String methodName,InstructionHandle stmt,Context context,Map<CallString,Map<Location,ValueMapping>> input,Interpreter<CallString,Map<Location,ValueMapping>> interpreter,Map<InstructionHandle,ContextMap<CallString,Map<Location,ValueMapping>>> state,Map<CallString,Map<Location,ValueMapping>> result){
  DFATool p=interpreter.getProgram();
  MethodInfo method=p.getMethod(methodName);
  methodName=method.getSignature().toString();
  if (method.isNative()) {
    handleNative(method,context,input,result);
  }
 else {
    int varPtr=context.stackPtr - MethodHelper.getArgSize(method);
    Context c=new Context(context);
    c.stackPtr=method.getCode().getMaxLocals();
    c.constPool=method.getClassInfo().getConstantPoolGen();
    if (method.isSynchronized()) {
      c.syncLevel=context.syncLevel + 1;
    }
    c.method=methodName;
    c.callString=c.callString.push(p.getMethod(context.method),stmt,callStringLength);
    Map<Location,ValueMapping> in=input.get(context.callString);
    Map<Location,ValueMapping> out=new HashMap<Location,ValueMapping>();
    for (    Location l : in.keySet()) {
      if (l.stackLoc < 0) {
        out.put(l,in.get(l));
      }
      if (l.stackLoc >= varPtr) {
        out.put(new Location(l.stackLoc - varPtr),new ValueMapping(in.get(l),false));
      }
    }
    ContextMap<CallString,Map<Location,ValueMapping>> tmpresult=new ContextMap<CallString,Map<Location,ValueMapping>>(c,new HashMap<CallString,Map<Location,ValueMapping>>());
    tmpresult.put(c.callString,out);
    InstructionHandle entry=method.getCode().getInstructionList().getStart();
    state.put(entry,join(state.get(entry),tmpresult));
    Map<InstructionHandle,ContextMap<CallString,Map<Location,ValueMapping>>> r=interpreter.interpret(c,entry,state,false);
    InstructionHandle exit=method.getCode().getInstructionList().getEnd();
    if (r.get(exit) != null) {
      Map<Location,ValueMapping> returned=r.get(exit).get(c.callString);
      if (returned != null) {
        for (        Location l : returned.keySet()) {
          if (l.stackLoc < 0) {
            ValueMapping m=new ValueMapping(returned.get(l),true);
            m.join(result.get(context.callString).get(l));
            result.get(context.callString).put(l,m);
          }
          if (l.stackLoc >= 0) {
            ValueMapping m=new ValueMapping(returned.get(l),false);
            Location loc=new Location(l.stackLoc + varPtr);
            m.join(result.get(context.callString).get(loc));
            result.get(context.callString).put(loc,m);
          }
        }
      }
    }
    for (    Location l : in.keySet()) {
      if (l.stackLoc >= 0 && l.stackLoc < context.stackPtr - MethodHelper.getArgSize(method)) {
        result.get(context.callString).put(l,new ValueMapping(in.get(l),true));
      }
    }
  }
}

Fixed version (ground truth):
private void doInvoke(String methodName,InstructionHandle stmt,Context context,Map<CallString,Map<Location,ValueMapping>> input,Interpreter<CallString,Map<Location,ValueMapping>> interpreter,Map<InstructionHandle,ContextMap<CallString,Map<Location,ValueMapping>>> state,Map<CallString,Map<Location,ValueMapping>> result){
  DFATool p=interpreter.getProgram();
  MethodInfo method=p.getMethod(methodName);
  if (method.isNative()) {
    handleNative(method,context,input,result);
  }
 else {
    int varPtr=context.stackPtr - MethodHelper.getArgSize(method);
    Context c=new Context(context);
    c.stackPtr=method.getCode().getMaxLocals();
    c.constPool=method.getClassInfo().getConstantPoolGen();
    if (method.isSynchronized()) {
      c.syncLevel=context.syncLevel + 1;
    }
    c.method=method.getMethodRef();
    c.callString=c.callString.push(method,stmt,callStringLength);
    Map<Location,ValueMapping> in=input.get(context.callString);
    Map<Location,ValueMapping> out=new HashMap<Location,ValueMapping>();
    for (    Location l : in.keySet()) {
      if (l.stackLoc < 0) {
        out.put(l,in.get(l));
      }
      if (l.stackLoc >= varPtr) {
        out.put(new Location(l.stackLoc - varPtr),new ValueMapping(in.get(l),false));
      }
    }
    ContextMap<CallString,Map<Location,ValueMapping>> tmpresult=new ContextMap<CallString,Map<Location,ValueMapping>>(c,new HashMap<CallString,Map<Location,ValueMapping>>());
    tmpresult.put(c.callString,out);
    InstructionHandle entry=method.getCode().getInstructionList().getStart();
    state.put(entry,join(state.get(entry),tmpresult));
    Map<InstructionHandle,ContextMap<CallString,Map<Location,ValueMapping>>> r=interpreter.interpret(c,entry,state,false);
    InstructionHandle exit=method.getCode().getInstructionList().getEnd();
    if (r.get(exit) != null) {
      Map<Location,ValueMapping> returned=r.get(exit).get(c.callString);
      if (returned != null) {
        for (        Location l : returned.keySet()) {
          if (l.stackLoc < 0) {
            ValueMapping m=new ValueMapping(returned.get(l),true);
            m.join(result.get(context.callString).get(l));
            result.get(context.callString).put(l,m);
          }
          if (l.stackLoc >= 0) {
            ValueMapping m=new ValueMapping(returned.get(l),false);
            Location loc=new Location(l.stackLoc + varPtr);
            m.join(result.get(context.callString).get(loc));
            result.get(context.callString).put(loc,m);
          }
        }
      }
    }
    for (    Location l : in.keySet()) {
      if (l.stackLoc >= 0 && l.stackLoc < context.stackPtr - MethodHelper.getArgSize(method)) {
        result.get(context.callString).put(l,new ValueMapping(in.get(l),true));
      }
    }
  }
}