Program: 24245
Project: 24245
Buggy source:
public boolean startInstrumentation(ComponentName className,String profileFile,int flags,Bundle arguments,IInstrumentationWatcher watcher){
  if (arguments != null && arguments.hasFileDescriptors()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
synchronized (this) {
    InstrumentationInfo ii=null;
    ApplicationInfo ai=null;
    try {
      ii=mContext.getPackageManager().getInstrumentationInfo(className,0);
      ai=mContext.getPackageManager().getApplicationInfo(ii.targetPackage,PackageManager.GET_SHARED_LIBRARY_FILES);
    }
 catch (    PackageManager.NameNotFoundException e) {
    }
    if (ii == null) {
      reportStartInstrumentationFailure(watcher,className,"String_Node_Str" + className);
      return false;
    }
    if (ai == null) {
      reportStartInstrumentationFailure(watcher,className,"String_Node_Str" + ii.targetPackage);
      return false;
    }
    int match=mContext.getPackageManager().checkSignatures(ii.targetPackage,ii.packageName);
    if (match < 0 && match != PackageManager.SIGNATURE_FIRST_NOT_SIGNED) {
      String msg="String_Node_Str" + className + "String_Node_Str"+ Binder.getCallingPid()+ "String_Node_Str"+ Binder.getCallingPid()+ "String_Node_Str"+ ii.packageName+ "String_Node_Str"+ ii.targetPackage;
      reportStartInstrumentationFailure(watcher,className,msg);
      throw new SecurityException(msg);
    }
    final long origId=Binder.clearCallingIdentity();
    uninstallPackageLocked(ii.targetPackage,-1,true);
    ProcessRecord app=addAppLocked(ai);
    app.instrumentationClass=className;
    app.instrumentationProfileFile=profileFile;
    app.instrumentationArguments=arguments;
    app.instrumentationWatcher=watcher;
    app.instrumentationResultClass=className;
    Binder.restoreCallingIdentity(origId);
  }
  return true;
}

Fixed version (ground truth):
public boolean startInstrumentation(ComponentName className,String profileFile,int flags,Bundle arguments,IInstrumentationWatcher watcher){
  if (arguments != null && arguments.hasFileDescriptors()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
synchronized (this) {
    InstrumentationInfo ii=null;
    ApplicationInfo ai=null;
    try {
      ii=mContext.getPackageManager().getInstrumentationInfo(className,STOCK_PM_FLAGS);
      ai=mContext.getPackageManager().getApplicationInfo(ii.targetPackage,STOCK_PM_FLAGS);
    }
 catch (    PackageManager.NameNotFoundException e) {
    }
    if (ii == null) {
      reportStartInstrumentationFailure(watcher,className,"String_Node_Str" + className);
      return false;
    }
    if (ai == null) {
      reportStartInstrumentationFailure(watcher,className,"String_Node_Str" + ii.targetPackage);
      return false;
    }
    int match=mContext.getPackageManager().checkSignatures(ii.targetPackage,ii.packageName);
    if (match < 0 && match != PackageManager.SIGNATURE_FIRST_NOT_SIGNED) {
      String msg="String_Node_Str" + className + "String_Node_Str"+ Binder.getCallingPid()+ "String_Node_Str"+ Binder.getCallingPid()+ "String_Node_Str"+ ii.packageName+ "String_Node_Str"+ ii.targetPackage;
      reportStartInstrumentationFailure(watcher,className,msg);
      throw new SecurityException(msg);
    }
    final long origId=Binder.clearCallingIdentity();
    uninstallPackageLocked(ii.targetPackage,-1,true);
    ProcessRecord app=addAppLocked(ai);
    app.instrumentationClass=className;
    app.instrumentationInfo=ai;
    app.instrumentationProfileFile=profileFile;
    app.instrumentationArguments=arguments;
    app.instrumentationWatcher=watcher;
    app.instrumentationResultClass=className;
    Binder.restoreCallingIdentity(origId);
  }
  return true;
}