Program: 38247
Project: 38247
Buggy source:
/** 
 * generate a synthetic method modeling the invocation of Function.call() at the site
 * @param caller
 * @param site
 * @param receiver
 * @return
 */
private IMethod getFunctionCallTarget(CGNode caller,CallSiteReference site,IClass receiver){
  int nargs=getNumberOfArgsPassed(caller,site);
  if (nargs < 2)   return null;
  String key=getKey(nargs,caller,site);
  if (callModels.containsKey(key)) {
    return callModels.get(key);
  }
  JSInstructionFactory insts=(JSInstructionFactory)receiver.getClassLoader().getInstructionFactory();
  MethodReference ref=genSyntheticMethodRef(receiver,nargs,key);
  JavaScriptSummary S=new JavaScriptSummary(ref,nargs);
  if (WARN_ABOUT_IMPRECISE_CALLGRAPH && caller.getMethod().getName().toString().contains(SYNTHETIC_CALL_METHOD_PREFIX))   warnAboutImpreciseCallGraph(caller,site);
  if (DEBUG_SYNTHETIC_CALL_METHODS) {
    IMethod method=caller.getMethod();
    if (method instanceof AstMethod) {
      int line=((AstMethod)method).getLineNumber(caller.getIR().getCallInstructionIndices(site).intIterator().next());
      System.err.println("String_Node_Str" + ref.getName() + "String_Node_Str"+ line+ "String_Node_Str"+ caller);
    }
 else {
      System.err.println("String_Node_Str" + ref.getName() + "String_Node_Str"+ method.getName());
    }
  }
  int resultVal=nargs + 2;
  CallSiteReference cs=new JSCallSiteReference(S.getNextProgramCounter());
  int[] params=new int[nargs - 2];
  for (int i=0; i < params.length; i++) {
    params[i]=i + 3;
  }
  S.addStatement(insts.Invoke(S.getNextProgramCounter(),2,resultVal,params,resultVal + 1,cs));
  S.addStatement(insts.ReturnInstruction(S.getNextProgramCounter(),resultVal,false));
  JavaScriptSummarizedFunction t=new JavaScriptSummarizedFunction(ref,S,receiver);
  callModels.put(key,t);
  return t;
}

Fixed version (ground truth):
/** 
 * generate a synthetic method modeling the invocation of Function.call() at the site
 * @param caller
 * @param site
 * @param receiver
 * @return
 */
private IMethod getFunctionCallTarget(CGNode caller,CallSiteReference site,IClass receiver){
  int nargs=getNumberOfArgsPassed(caller,site);
  if (nargs < 2)   return null;
  String key=getKey(nargs,caller,site);
  if (callModels.containsKey(key)) {
    return callModels.get(key);
  }
  JSInstructionFactory insts=(JSInstructionFactory)receiver.getClassLoader().getInstructionFactory();
  MethodReference ref=genSyntheticMethodRef(receiver,nargs,key);
  JavaScriptSummary S=new JavaScriptSummary(ref,nargs);
  if (WARN_ABOUT_IMPRECISE_CALLGRAPH && caller.getMethod().getName().toString().contains(SYNTHETIC_CALL_METHOD_PREFIX))   warnAboutImpreciseCallGraph(caller,site);
  if (DEBUG_SYNTHETIC_CALL_METHODS) {
    IMethod method=caller.getMethod();
    if (method instanceof AstMethod) {
      int line=((AstMethod)method).getLineNumber(caller.getIR().getCallInstructionIndices(site).intIterator().next());
      System.err.println("String_Node_Str" + ref.getName() + "String_Node_Str"+ line+ "String_Node_Str"+ caller);
    }
 else {
      System.err.println("String_Node_Str" + ref.getName() + "String_Node_Str"+ method.getName());
    }
  }
  int resultVal=nargs + 2;
  CallSiteReference cs=new JSCallSiteReference(S.getNextProgramCounter());
  int[] params=new int[nargs - 2];
  for (int i=0; i < params.length; i++) {
    params[i]=i + 3;
  }
  S.addStatement(insts.Invoke(S.getNumberOfStatements(),2,resultVal,params,resultVal + 1,cs));
  S.getNextProgramCounter();
  S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(),resultVal,false));
  S.getNextProgramCounter();
  JavaScriptSummarizedFunction t=new JavaScriptSummarizedFunction(ref,S,receiver);
  callModels.put(key,t);
  return t;
}