Program: 191331
Project: 191331
Buggy source:
@Override protected void dump(FileDescriptor fd,PrintWriter pw,String[] args){
  if (checkCallingPermission(android.Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) {
    pw.println("String_Node_Str" + Binder.getCallingPid() + "String_Node_Str"+ Binder.getCallingUid()+ "String_Node_Str"+ android.Manifest.permission.DUMP);
    return;
  }
  boolean dumpAll=false;
  boolean dumpClient=false;
  boolean dumpCheckin=false;
  boolean dumpCheckinFormat=false;
  String dumpPackage=null;
  int opti=0;
  while (opti < args.length) {
    String opt=args[opti];
    if (opt == null || opt.length() <= 0 || opt.charAt(0) != '-') {
      break;
    }
    opti++;
    if ("String_Node_Str".equals(opt)) {
      dumpAll=true;
    }
 else     if ("String_Node_Str".equals(opt)) {
      dumpClient=true;
    }
 else     if ("String_Node_Str".equals(opt)) {
      if (opti < args.length) {
        dumpPackage=args[opti];
        opti++;
      }
 else {
        pw.println("String_Node_Str");
        return;
      }
      dumpClient=true;
    }
 else     if ("String_Node_Str".equals(opt)) {
      dumpCheckin=dumpCheckinFormat=true;
    }
 else     if ("String_Node_Str".equals(opt)) {
      dumpCheckinFormat=true;
    }
 else     if ("String_Node_Str".equals(opt)) {
      ActivityManagerShellCommand.dumpHelp(pw,true);
      return;
    }
 else {
      pw.println("String_Node_Str" + opt + "String_Node_Str");
    }
  }
  long origId=Binder.clearCallingIdentity();
  boolean more=false;
  if (opti < args.length) {
    String cmd=args[opti];
    opti++;
    if ("String_Node_Str".equals(cmd) || "String_Node_Str".equals(cmd)) {
synchronized (this) {
        dumpActivitiesLocked(fd,pw,args,opti,true,dumpClient,dumpPackage);
      }
    }
 else     if ("String_Node_Str".equals(cmd) || "String_Node_Str".equals(cmd)) {
synchronized (this) {
        dumpRecentsLocked(fd,pw,args,opti,true,dumpPackage);
      }
    }
 else     if ("String_Node_Str".equals(cmd) || "String_Node_Str".equals(cmd)) {
      String[] newArgs;
      String name;
      if (opti >= args.length) {
        name=null;
        newArgs=EMPTY_STRING_ARRAY;
      }
 else {
        dumpPackage=args[opti];
        opti++;
        newArgs=new String[args.length - opti];
        if (args.length > 2)         System.arraycopy(args,opti,newArgs,0,args.length - opti);
      }
synchronized (this) {
        dumpBroadcastsLocked(fd,pw,args,opti,true,dumpPackage);
      }
    }
 else     if ("String_Node_Str".equals(cmd)) {
      String[] newArgs;
      String name;
      if (opti >= args.length) {
        name=null;
        newArgs=EMPTY_STRING_ARRAY;
      }
 else {
        dumpPackage=args[opti];
        opti++;
        newArgs=new String[args.length - opti];
        if (args.length > 2)         System.arraycopy(args,opti,newArgs,0,args.length - opti);
      }
synchronized (this) {
        dumpBroadcastStatsLocked(fd,pw,args,opti,true,dumpPackage);
      }
    }
 else     if ("String_Node_Str".equals(cmd) || "String_Node_Str".equals(cmd)) {
      String[] newArgs;
      String name;
      if (opti >= args.length) {
        name=null;
        newArgs=EMPTY_STRING_ARRAY;
      }
 else {
        dumpPackage=args[opti];
        opti++;
        newArgs=new String[args.length - opti];
        if (args.length > 2)         System.arraycopy(args,opti,newArgs,0,args.length - opti);
      }
synchronized (this) {
        dumpPendingIntentsLocked(fd,pw,args,opti,true,dumpPackage);
      }
    }
 else     if ("String_Node_Str".equals(cmd) || "String_Node_Str".equals(cmd)) {
      String[] newArgs;
      String name;
      if (opti >= args.length) {
        name=null;
        newArgs=EMPTY_STRING_ARRAY;
      }
 else {
        dumpPackage=args[opti];
        opti++;
        newArgs=new String[args.length - opti];
        if (args.length > 2)         System.arraycopy(args,opti,newArgs,0,args.length - opti);
      }
synchronized (this) {
        dumpProcessesLocked(fd,pw,args,opti,true,dumpPackage);
      }
    }
 else     if ("String_Node_Str".equals(cmd) || "String_Node_Str".equals(cmd)) {
synchronized (this) {
        dumpOomLocked(fd,pw,args,opti,true);
      }
    }
 else     if ("String_Node_Str".equals(cmd) || "String_Node_Str".equals(cmd)) {
synchronized (this) {
        dumpPermissionsLocked(fd,pw,args,opti,true,null);
      }
    }
 else     if ("String_Node_Str".equals(cmd)) {
      String[] newArgs;
      String name;
      if (opti >= args.length) {
        name=null;
        newArgs=EMPTY_STRING_ARRAY;
      }
 else {
        name=args[opti];
        opti++;
        newArgs=new String[args.length - opti];
        if (args.length > 2)         System.arraycopy(args,opti,newArgs,0,args.length - opti);
      }
      if (!dumpProvider(fd,pw,name,newArgs,0,dumpAll)) {
        pw.println("String_Node_Str" + name);
        pw.println("String_Node_Str");
      }
    }
 else     if ("String_Node_Str".equals(cmd) || "String_Node_Str".equals(cmd)) {
synchronized (this) {
        dumpProvidersLocked(fd,pw,args,opti,true,null);
      }
    }
 else     if ("String_Node_Str".equals(cmd)) {
      String[] newArgs;
      String name;
      if (opti >= args.length) {
        name=null;
        newArgs=EMPTY_STRING_ARRAY;
      }
 else {
        name=args[opti];
        opti++;
        newArgs=new String[args.length - opti];
        if (args.length > 2)         System.arraycopy(args,opti,newArgs,0,args.length - opti);
      }
      if (!mServices.dumpService(fd,pw,name,newArgs,0,dumpAll)) {
        pw.println("String_Node_Str" + name);
        pw.println("String_Node_Str");
      }
    }
 else     if ("String_Node_Str".equals(cmd)) {
      String[] newArgs;
      if (opti >= args.length) {
        pw.println("String_Node_Str");
        pw.println("String_Node_Str");
      }
 else {
        dumpPackage=args[opti];
        opti++;
        newArgs=new String[args.length - opti];
        if (args.length > 2)         System.arraycopy(args,opti,newArgs,0,args.length - opti);
        args=newArgs;
        opti=0;
        more=true;
      }
    }
 else     if ("String_Node_Str".equals(cmd) || "String_Node_Str".equals(cmd)) {
synchronized (this) {
        dumpAssociationsLocked(fd,pw,args,opti,true,dumpClient,dumpPackage);
      }
    }
 else     if ("String_Node_Str".equals(cmd) || "String_Node_Str".equals(cmd)) {
      if (dumpClient) {
        ActiveServices.ServiceDumper dumper;
synchronized (this) {
          dumper=mServices.newServiceDumperLocked(fd,pw,args,opti,true,dumpPackage);
        }
        dumper.dumpWithClient();
      }
 else {
synchronized (this) {
          mServices.newServiceDumperLocked(fd,pw,args,opti,true,dumpPackage).dumpLocked();
        }
      }
    }
 else     if ("String_Node_Str".equals(cmd)) {
      LockGuard.dump(fd,pw,args);
    }
 else {
      if (!dumpActivity(fd,pw,cmd,args,opti,dumpAll)) {
        ActivityManagerShellCommand shell=new ActivityManagerShellCommand(this,true);
        int res=shell.exec(this,null,fd,null,args,new ResultReceiver(null));
        if (res < 0) {
          pw.println("String_Node_Str" + cmd);
          pw.println("String_Node_Str");
        }
      }
    }
    if (!more) {
      Binder.restoreCallingIdentity(origId);
      return;
    }
  }
  if (dumpCheckinFormat) {
    dumpBroadcastStatsCheckinLocked(fd,pw,args,opti,dumpCheckin,dumpPackage);
  }
 else   if (dumpClient) {
    ActiveServices.ServiceDumper sdumper;
synchronized (this) {
      dumpPendingIntentsLocked(fd,pw,args,opti,dumpAll,dumpPackage);
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      dumpBroadcastsLocked(fd,pw,args,opti,dumpAll,dumpPackage);
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      if (dumpAll || dumpPackage != null) {
        dumpBroadcastStatsLocked(fd,pw,args,opti,dumpAll,dumpPackage);
        pw.println();
        if (dumpAll) {
          pw.println("String_Node_Str");
        }
      }
      dumpProvidersLocked(fd,pw,args,opti,dumpAll,dumpPackage);
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      dumpPermissionsLocked(fd,pw,args,opti,dumpAll,dumpPackage);
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      sdumper=mServices.newServiceDumperLocked(fd,pw,args,opti,dumpAll,dumpPackage);
    }
    sdumper.dumpWithClient();
    pw.println();
synchronized (this) {
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      dumpRecentsLocked(fd,pw,args,opti,dumpAll,dumpPackage);
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      dumpActivitiesLocked(fd,pw,args,opti,dumpAll,dumpClient,dumpPackage);
      if (mAssociations.size() > 0) {
        pw.println();
        if (dumpAll) {
          pw.println("String_Node_Str");
        }
        dumpAssociationsLocked(fd,pw,args,opti,dumpAll,dumpClient,dumpPackage);
      }
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      dumpProcessesLocked(fd,pw,args,opti,dumpAll,dumpPackage);
    }
  }
 else {
synchronized (this) {
      dumpPendingIntentsLocked(fd,pw,args,opti,dumpAll,dumpPackage);
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      dumpBroadcastsLocked(fd,pw,args,opti,dumpAll,dumpPackage);
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      if (dumpAll || dumpPackage != null) {
        dumpBroadcastStatsLocked(fd,pw,args,opti,dumpAll,dumpPackage);
        pw.println();
        if (dumpAll) {
          pw.println("String_Node_Str");
        }
      }
      dumpProvidersLocked(fd,pw,args,opti,dumpAll,dumpPackage);
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      dumpPermissionsLocked(fd,pw,args,opti,dumpAll,dumpPackage);
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      mServices.newServiceDumperLocked(fd,pw,args,opti,dumpAll,dumpPackage).dumpLocked();
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      dumpRecentsLocked(fd,pw,args,opti,dumpAll,dumpPackage);
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      dumpActivitiesLocked(fd,pw,args,opti,dumpAll,dumpClient,dumpPackage);
      if (mAssociations.size() > 0) {
        pw.println();
        if (dumpAll) {
          pw.println("String_Node_Str");
        }
        dumpAssociationsLocked(fd,pw,args,opti,dumpAll,dumpClient,dumpPackage);
      }
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      dumpProcessesLocked(fd,pw,args,opti,dumpAll,dumpPackage);
    }
  }
  Binder.restoreCallingIdentity(origId);
}

Fixed version (ground truth):
@Override protected void dump(FileDescriptor fd,PrintWriter pw,String[] args){
  if (checkCallingPermission(android.Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) {
    pw.println("String_Node_Str" + Binder.getCallingPid() + "String_Node_Str"+ Binder.getCallingUid()+ "String_Node_Str"+ android.Manifest.permission.DUMP);
    return;
  }
  boolean dumpAll=false;
  boolean dumpClient=false;
  boolean dumpCheckin=false;
  boolean dumpCheckinFormat=false;
  String dumpPackage=null;
  int opti=0;
  while (opti < args.length) {
    String opt=args[opti];
    if (opt == null || opt.length() <= 0 || opt.charAt(0) != '-') {
      break;
    }
    opti++;
    if ("String_Node_Str".equals(opt)) {
      dumpAll=true;
    }
 else     if ("String_Node_Str".equals(opt)) {
      dumpClient=true;
    }
 else     if ("String_Node_Str".equals(opt)) {
      if (opti < args.length) {
        dumpPackage=args[opti];
        opti++;
      }
 else {
        pw.println("String_Node_Str");
        return;
      }
      dumpClient=true;
    }
 else     if ("String_Node_Str".equals(opt)) {
      dumpCheckin=dumpCheckinFormat=true;
    }
 else     if ("String_Node_Str".equals(opt)) {
      dumpCheckinFormat=true;
    }
 else     if ("String_Node_Str".equals(opt)) {
      ActivityManagerShellCommand.dumpHelp(pw,true);
      return;
    }
 else {
      pw.println("String_Node_Str" + opt + "String_Node_Str");
    }
  }
  long origId=Binder.clearCallingIdentity();
  boolean more=false;
  if (opti < args.length) {
    String cmd=args[opti];
    opti++;
    if ("String_Node_Str".equals(cmd) || "String_Node_Str".equals(cmd)) {
synchronized (this) {
        dumpActivitiesLocked(fd,pw,args,opti,true,dumpClient,dumpPackage);
      }
    }
 else     if ("String_Node_Str".equals(cmd) || "String_Node_Str".equals(cmd)) {
synchronized (this) {
        dumpRecentsLocked(fd,pw,args,opti,true,dumpPackage);
      }
    }
 else     if ("String_Node_Str".equals(cmd) || "String_Node_Str".equals(cmd)) {
      String[] newArgs;
      String name;
      if (opti >= args.length) {
        name=null;
        newArgs=EMPTY_STRING_ARRAY;
      }
 else {
        dumpPackage=args[opti];
        opti++;
        newArgs=new String[args.length - opti];
        if (args.length > 2)         System.arraycopy(args,opti,newArgs,0,args.length - opti);
      }
synchronized (this) {
        dumpBroadcastsLocked(fd,pw,args,opti,true,dumpPackage);
      }
    }
 else     if ("String_Node_Str".equals(cmd)) {
      String[] newArgs;
      String name;
      if (opti >= args.length) {
        name=null;
        newArgs=EMPTY_STRING_ARRAY;
      }
 else {
        dumpPackage=args[opti];
        opti++;
        newArgs=new String[args.length - opti];
        if (args.length > 2)         System.arraycopy(args,opti,newArgs,0,args.length - opti);
      }
synchronized (this) {
        if (dumpCheckinFormat) {
          dumpBroadcastStatsCheckinLocked(fd,pw,args,opti,dumpCheckin,dumpPackage);
        }
 else {
          dumpBroadcastStatsLocked(fd,pw,args,opti,true,dumpPackage);
        }
      }
    }
 else     if ("String_Node_Str".equals(cmd) || "String_Node_Str".equals(cmd)) {
      String[] newArgs;
      String name;
      if (opti >= args.length) {
        name=null;
        newArgs=EMPTY_STRING_ARRAY;
      }
 else {
        dumpPackage=args[opti];
        opti++;
        newArgs=new String[args.length - opti];
        if (args.length > 2)         System.arraycopy(args,opti,newArgs,0,args.length - opti);
      }
synchronized (this) {
        dumpPendingIntentsLocked(fd,pw,args,opti,true,dumpPackage);
      }
    }
 else     if ("String_Node_Str".equals(cmd) || "String_Node_Str".equals(cmd)) {
      String[] newArgs;
      String name;
      if (opti >= args.length) {
        name=null;
        newArgs=EMPTY_STRING_ARRAY;
      }
 else {
        dumpPackage=args[opti];
        opti++;
        newArgs=new String[args.length - opti];
        if (args.length > 2)         System.arraycopy(args,opti,newArgs,0,args.length - opti);
      }
synchronized (this) {
        dumpProcessesLocked(fd,pw,args,opti,true,dumpPackage);
      }
    }
 else     if ("String_Node_Str".equals(cmd) || "String_Node_Str".equals(cmd)) {
synchronized (this) {
        dumpOomLocked(fd,pw,args,opti,true);
      }
    }
 else     if ("String_Node_Str".equals(cmd) || "String_Node_Str".equals(cmd)) {
synchronized (this) {
        dumpPermissionsLocked(fd,pw,args,opti,true,null);
      }
    }
 else     if ("String_Node_Str".equals(cmd)) {
      String[] newArgs;
      String name;
      if (opti >= args.length) {
        name=null;
        newArgs=EMPTY_STRING_ARRAY;
      }
 else {
        name=args[opti];
        opti++;
        newArgs=new String[args.length - opti];
        if (args.length > 2)         System.arraycopy(args,opti,newArgs,0,args.length - opti);
      }
      if (!dumpProvider(fd,pw,name,newArgs,0,dumpAll)) {
        pw.println("String_Node_Str" + name);
        pw.println("String_Node_Str");
      }
    }
 else     if ("String_Node_Str".equals(cmd) || "String_Node_Str".equals(cmd)) {
synchronized (this) {
        dumpProvidersLocked(fd,pw,args,opti,true,null);
      }
    }
 else     if ("String_Node_Str".equals(cmd)) {
      String[] newArgs;
      String name;
      if (opti >= args.length) {
        name=null;
        newArgs=EMPTY_STRING_ARRAY;
      }
 else {
        name=args[opti];
        opti++;
        newArgs=new String[args.length - opti];
        if (args.length > 2)         System.arraycopy(args,opti,newArgs,0,args.length - opti);
      }
      if (!mServices.dumpService(fd,pw,name,newArgs,0,dumpAll)) {
        pw.println("String_Node_Str" + name);
        pw.println("String_Node_Str");
      }
    }
 else     if ("String_Node_Str".equals(cmd)) {
      String[] newArgs;
      if (opti >= args.length) {
        pw.println("String_Node_Str");
        pw.println("String_Node_Str");
      }
 else {
        dumpPackage=args[opti];
        opti++;
        newArgs=new String[args.length - opti];
        if (args.length > 2)         System.arraycopy(args,opti,newArgs,0,args.length - opti);
        args=newArgs;
        opti=0;
        more=true;
      }
    }
 else     if ("String_Node_Str".equals(cmd) || "String_Node_Str".equals(cmd)) {
synchronized (this) {
        dumpAssociationsLocked(fd,pw,args,opti,true,dumpClient,dumpPackage);
      }
    }
 else     if ("String_Node_Str".equals(cmd) || "String_Node_Str".equals(cmd)) {
      if (dumpClient) {
        ActiveServices.ServiceDumper dumper;
synchronized (this) {
          dumper=mServices.newServiceDumperLocked(fd,pw,args,opti,true,dumpPackage);
        }
        dumper.dumpWithClient();
      }
 else {
synchronized (this) {
          mServices.newServiceDumperLocked(fd,pw,args,opti,true,dumpPackage).dumpLocked();
        }
      }
    }
 else     if ("String_Node_Str".equals(cmd)) {
      LockGuard.dump(fd,pw,args);
    }
 else {
      if (!dumpActivity(fd,pw,cmd,args,opti,dumpAll)) {
        ActivityManagerShellCommand shell=new ActivityManagerShellCommand(this,true);
        int res=shell.exec(this,null,fd,null,args,new ResultReceiver(null));
        if (res < 0) {
          pw.println("String_Node_Str" + cmd);
          pw.println("String_Node_Str");
        }
      }
    }
    if (!more) {
      Binder.restoreCallingIdentity(origId);
      return;
    }
  }
  if (dumpCheckinFormat) {
    dumpBroadcastStatsCheckinLocked(fd,pw,args,opti,dumpCheckin,dumpPackage);
  }
 else   if (dumpClient) {
    ActiveServices.ServiceDumper sdumper;
synchronized (this) {
      dumpPendingIntentsLocked(fd,pw,args,opti,dumpAll,dumpPackage);
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      dumpBroadcastsLocked(fd,pw,args,opti,dumpAll,dumpPackage);
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      if (dumpAll || dumpPackage != null) {
        dumpBroadcastStatsLocked(fd,pw,args,opti,dumpAll,dumpPackage);
        pw.println();
        if (dumpAll) {
          pw.println("String_Node_Str");
        }
      }
      dumpProvidersLocked(fd,pw,args,opti,dumpAll,dumpPackage);
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      dumpPermissionsLocked(fd,pw,args,opti,dumpAll,dumpPackage);
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      sdumper=mServices.newServiceDumperLocked(fd,pw,args,opti,dumpAll,dumpPackage);
    }
    sdumper.dumpWithClient();
    pw.println();
synchronized (this) {
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      dumpRecentsLocked(fd,pw,args,opti,dumpAll,dumpPackage);
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      dumpActivitiesLocked(fd,pw,args,opti,dumpAll,dumpClient,dumpPackage);
      if (mAssociations.size() > 0) {
        pw.println();
        if (dumpAll) {
          pw.println("String_Node_Str");
        }
        dumpAssociationsLocked(fd,pw,args,opti,dumpAll,dumpClient,dumpPackage);
      }
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      dumpProcessesLocked(fd,pw,args,opti,dumpAll,dumpPackage);
    }
  }
 else {
synchronized (this) {
      dumpPendingIntentsLocked(fd,pw,args,opti,dumpAll,dumpPackage);
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      dumpBroadcastsLocked(fd,pw,args,opti,dumpAll,dumpPackage);
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      if (dumpAll || dumpPackage != null) {
        dumpBroadcastStatsLocked(fd,pw,args,opti,dumpAll,dumpPackage);
        pw.println();
        if (dumpAll) {
          pw.println("String_Node_Str");
        }
      }
      dumpProvidersLocked(fd,pw,args,opti,dumpAll,dumpPackage);
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      dumpPermissionsLocked(fd,pw,args,opti,dumpAll,dumpPackage);
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      mServices.newServiceDumperLocked(fd,pw,args,opti,dumpAll,dumpPackage).dumpLocked();
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      dumpRecentsLocked(fd,pw,args,opti,dumpAll,dumpPackage);
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      dumpActivitiesLocked(fd,pw,args,opti,dumpAll,dumpClient,dumpPackage);
      if (mAssociations.size() > 0) {
        pw.println();
        if (dumpAll) {
          pw.println("String_Node_Str");
        }
        dumpAssociationsLocked(fd,pw,args,opti,dumpAll,dumpClient,dumpPackage);
      }
      pw.println();
      if (dumpAll) {
        pw.println("String_Node_Str");
      }
      dumpProcessesLocked(fd,pw,args,opti,dumpAll,dumpPackage);
    }
  }
  Binder.restoreCallingIdentity(origId);
}