Program: 191581
Project: 191581
Buggy source:
public void readFromParcel(Parcel in){
  final boolean hadData=mPackages.getMap().size() > 0 || mProcesses.getMap().size() > 0;
  if (hadData) {
    resetSafely();
  }
  if (!readCheckedInt(in,MAGIC,"String_Node_Str")) {
    return;
  }
  int version=in.readInt();
  if (version != PARCEL_VERSION) {
    mReadError="String_Node_Str" + version;
    return;
  }
  if (!readCheckedInt(in,STATE_COUNT,"String_Node_Str")) {
    return;
  }
  if (!readCheckedInt(in,ADJ_COUNT,"String_Node_Str")) {
    return;
  }
  if (!readCheckedInt(in,PSS_COUNT,"String_Node_Str")) {
    return;
  }
  if (!readCheckedInt(in,SYS_MEM_USAGE_COUNT,"String_Node_Str")) {
    return;
  }
  if (!readCheckedInt(in,SparseMappingTable.ARRAY_SIZE,"String_Node_Str")) {
    return;
  }
  mIndexToCommonString=new ArrayList<String>();
  mTimePeriodStartClock=in.readLong();
  buildTimePeriodStartClockStr();
  mTimePeriodStartRealtime=in.readLong();
  mTimePeriodEndRealtime=in.readLong();
  mTimePeriodStartUptime=in.readLong();
  mTimePeriodEndUptime=in.readLong();
  mRuntime=in.readString();
  mFlags=in.readInt();
  mTableData.readFromParcel(in);
  readCompactedLongArray(in,version,mMemFactorDurations,mMemFactorDurations.length);
  if (!mSysMemUsage.readFromParcel(in)) {
    return;
  }
  int NPROC=in.readInt();
  if (NPROC < 0) {
    mReadError="String_Node_Str" + NPROC;
    return;
  }
  while (NPROC > 0) {
    NPROC--;
    final String procName=readCommonString(in,version);
    if (procName == null) {
      mReadError="String_Node_Str";
      return;
    }
    int NUID=in.readInt();
    if (NUID < 0) {
      mReadError="String_Node_Str" + NUID;
      return;
    }
    while (NUID > 0) {
      NUID--;
      final int uid=in.readInt();
      if (uid < 0) {
        mReadError="String_Node_Str" + uid;
        return;
      }
      final String pkgName=readCommonString(in,version);
      if (pkgName == null) {
        mReadError="String_Node_Str";
        return;
      }
      final int vers=in.readInt();
      ProcessState proc=hadData ? mProcesses.get(procName,uid) : null;
      if (proc != null) {
        if (!proc.readFromParcel(in,false)) {
          return;
        }
      }
 else {
        proc=new ProcessState(this,pkgName,uid,vers,procName);
        if (!proc.readFromParcel(in,true)) {
          return;
        }
      }
      if (DEBUG_PARCEL)       Slog.d(TAG,"String_Node_Str" + procName + "String_Node_Str"+ uid+ "String_Node_Str"+ proc);
      mProcesses.put(procName,uid,proc);
    }
  }
  if (DEBUG_PARCEL)   Slog.d(TAG,"String_Node_Str" + mProcesses.getMap().size() + "String_Node_Str");
  int NPKG=in.readInt();
  if (NPKG < 0) {
    mReadError="String_Node_Str" + NPKG;
    return;
  }
  while (NPKG > 0) {
    NPKG--;
    final String pkgName=readCommonString(in,version);
    if (pkgName == null) {
      mReadError="String_Node_Str";
      return;
    }
    int NUID=in.readInt();
    if (NUID < 0) {
      mReadError="String_Node_Str" + NUID;
      return;
    }
    while (NUID > 0) {
      NUID--;
      final int uid=in.readInt();
      if (uid < 0) {
        mReadError="String_Node_Str" + uid;
        return;
      }
      int NVERS=in.readInt();
      if (NVERS < 0) {
        mReadError="String_Node_Str" + NVERS;
        return;
      }
      while (NVERS > 0) {
        NVERS--;
        final int vers=in.readInt();
        PackageState pkgState=new PackageState(pkgName,uid);
        SparseArray<PackageState> vpkg=mPackages.get(pkgName,uid);
        if (vpkg == null) {
          vpkg=new SparseArray<PackageState>();
          mPackages.put(pkgName,uid,vpkg);
        }
        vpkg.put(vers,pkgState);
        int NPROCS=in.readInt();
        if (NPROCS < 0) {
          mReadError="String_Node_Str" + NPROCS;
          return;
        }
        while (NPROCS > 0) {
          NPROCS--;
          String procName=readCommonString(in,version);
          if (procName == null) {
            mReadError="String_Node_Str";
            return;
          }
          int hasProc=in.readInt();
          if (DEBUG_PARCEL)           Slog.d(TAG,"String_Node_Str" + pkgName + "String_Node_Str"+ uid+ "String_Node_Str"+ procName+ "String_Node_Str"+ hasProc);
          ProcessState commonProc=mProcesses.get(procName,uid);
          if (DEBUG_PARCEL)           Slog.d(TAG,"String_Node_Str" + procName + "String_Node_Str"+ uid+ "String_Node_Str"+ commonProc);
          if (commonProc == null) {
            mReadError="String_Node_Str" + procName;
            return;
          }
          if (hasProc != 0) {
            ProcessState proc=hadData ? pkgState.mProcesses.get(procName) : null;
            if (proc != null) {
              if (!proc.readFromParcel(in,false)) {
                return;
              }
            }
 else {
              proc=new ProcessState(commonProc,pkgName,uid,vers,procName,0);
              if (!proc.readFromParcel(in,true)) {
                return;
              }
            }
            if (DEBUG_PARCEL)             Slog.d(TAG,"String_Node_Str" + pkgName + "String_Node_Str"+ procName+ "String_Node_Str"+ uid+ "String_Node_Str"+ proc);
            pkgState.mProcesses.put(procName,proc);
          }
 else {
            if (DEBUG_PARCEL)             Slog.d(TAG,"String_Node_Str" + pkgName + "String_Node_Str"+ procName+ "String_Node_Str"+ uid+ "String_Node_Str"+ commonProc);
            pkgState.mProcesses.put(procName,commonProc);
          }
        }
        int NSRVS=in.readInt();
        if (NSRVS < 0) {
          mReadError="String_Node_Str" + NSRVS;
          return;
        }
        while (NSRVS > 0) {
          NSRVS--;
          String serviceName=in.readString();
          if (serviceName == null) {
            mReadError="String_Node_Str";
            return;
          }
          String processName=version > 9 ? readCommonString(in,version) : null;
          ServiceState serv=hadData ? pkgState.mServices.get(serviceName) : null;
          if (serv == null) {
            serv=new ServiceState(this,pkgName,serviceName,processName,null);
          }
          if (!serv.readFromParcel(in)) {
            return;
          }
          if (DEBUG_PARCEL)           Slog.d(TAG,"String_Node_Str" + pkgName + "String_Node_Str"+ serviceName+ "String_Node_Str"+ uid+ "String_Node_Str"+ serv);
          pkgState.mServices.put(serviceName,serv);
        }
      }
    }
  }
  mIndexToCommonString=null;
  if (DEBUG_PARCEL)   Slog.d(TAG,"String_Node_Str");
}

Fixed version (ground truth):
public void readFromParcel(Parcel in){
  final boolean hadData=mPackages.getMap().size() > 0 || mProcesses.getMap().size() > 0;
  if (hadData) {
    resetSafely();
  }
  if (!readCheckedInt(in,MAGIC,"String_Node_Str")) {
    return;
  }
  int version=in.readInt();
  if (version != PARCEL_VERSION) {
    mReadError="String_Node_Str" + version;
    return;
  }
  if (!readCheckedInt(in,STATE_COUNT,"String_Node_Str")) {
    return;
  }
  if (!readCheckedInt(in,ADJ_COUNT,"String_Node_Str")) {
    return;
  }
  if (!readCheckedInt(in,PSS_COUNT,"String_Node_Str")) {
    return;
  }
  if (!readCheckedInt(in,SYS_MEM_USAGE_COUNT,"String_Node_Str")) {
    return;
  }
  if (!readCheckedInt(in,SparseMappingTable.ARRAY_SIZE,"String_Node_Str")) {
    return;
  }
  mIndexToCommonString=new ArrayList<String>();
  mTimePeriodStartClock=in.readLong();
  buildTimePeriodStartClockStr();
  mTimePeriodStartRealtime=in.readLong();
  mTimePeriodEndRealtime=in.readLong();
  mTimePeriodStartUptime=in.readLong();
  mTimePeriodEndUptime=in.readLong();
  mRuntime=in.readString();
  mHasSwappedOutPss=in.readInt() != 0;
  mFlags=in.readInt();
  mTableData.readFromParcel(in);
  readCompactedLongArray(in,version,mMemFactorDurations,mMemFactorDurations.length);
  if (!mSysMemUsage.readFromParcel(in)) {
    return;
  }
  int NPROC=in.readInt();
  if (NPROC < 0) {
    mReadError="String_Node_Str" + NPROC;
    return;
  }
  while (NPROC > 0) {
    NPROC--;
    final String procName=readCommonString(in,version);
    if (procName == null) {
      mReadError="String_Node_Str";
      return;
    }
    int NUID=in.readInt();
    if (NUID < 0) {
      mReadError="String_Node_Str" + NUID;
      return;
    }
    while (NUID > 0) {
      NUID--;
      final int uid=in.readInt();
      if (uid < 0) {
        mReadError="String_Node_Str" + uid;
        return;
      }
      final String pkgName=readCommonString(in,version);
      if (pkgName == null) {
        mReadError="String_Node_Str";
        return;
      }
      final int vers=in.readInt();
      ProcessState proc=hadData ? mProcesses.get(procName,uid) : null;
      if (proc != null) {
        if (!proc.readFromParcel(in,false)) {
          return;
        }
      }
 else {
        proc=new ProcessState(this,pkgName,uid,vers,procName);
        if (!proc.readFromParcel(in,true)) {
          return;
        }
      }
      if (DEBUG_PARCEL)       Slog.d(TAG,"String_Node_Str" + procName + "String_Node_Str"+ uid+ "String_Node_Str"+ proc);
      mProcesses.put(procName,uid,proc);
    }
  }
  if (DEBUG_PARCEL)   Slog.d(TAG,"String_Node_Str" + mProcesses.getMap().size() + "String_Node_Str");
  int NPKG=in.readInt();
  if (NPKG < 0) {
    mReadError="String_Node_Str" + NPKG;
    return;
  }
  while (NPKG > 0) {
    NPKG--;
    final String pkgName=readCommonString(in,version);
    if (pkgName == null) {
      mReadError="String_Node_Str";
      return;
    }
    int NUID=in.readInt();
    if (NUID < 0) {
      mReadError="String_Node_Str" + NUID;
      return;
    }
    while (NUID > 0) {
      NUID--;
      final int uid=in.readInt();
      if (uid < 0) {
        mReadError="String_Node_Str" + uid;
        return;
      }
      int NVERS=in.readInt();
      if (NVERS < 0) {
        mReadError="String_Node_Str" + NVERS;
        return;
      }
      while (NVERS > 0) {
        NVERS--;
        final int vers=in.readInt();
        PackageState pkgState=new PackageState(pkgName,uid);
        SparseArray<PackageState> vpkg=mPackages.get(pkgName,uid);
        if (vpkg == null) {
          vpkg=new SparseArray<PackageState>();
          mPackages.put(pkgName,uid,vpkg);
        }
        vpkg.put(vers,pkgState);
        int NPROCS=in.readInt();
        if (NPROCS < 0) {
          mReadError="String_Node_Str" + NPROCS;
          return;
        }
        while (NPROCS > 0) {
          NPROCS--;
          String procName=readCommonString(in,version);
          if (procName == null) {
            mReadError="String_Node_Str";
            return;
          }
          int hasProc=in.readInt();
          if (DEBUG_PARCEL)           Slog.d(TAG,"String_Node_Str" + pkgName + "String_Node_Str"+ uid+ "String_Node_Str"+ procName+ "String_Node_Str"+ hasProc);
          ProcessState commonProc=mProcesses.get(procName,uid);
          if (DEBUG_PARCEL)           Slog.d(TAG,"String_Node_Str" + procName + "String_Node_Str"+ uid+ "String_Node_Str"+ commonProc);
          if (commonProc == null) {
            mReadError="String_Node_Str" + procName;
            return;
          }
          if (hasProc != 0) {
            ProcessState proc=hadData ? pkgState.mProcesses.get(procName) : null;
            if (proc != null) {
              if (!proc.readFromParcel(in,false)) {
                return;
              }
            }
 else {
              proc=new ProcessState(commonProc,pkgName,uid,vers,procName,0);
              if (!proc.readFromParcel(in,true)) {
                return;
              }
            }
            if (DEBUG_PARCEL)             Slog.d(TAG,"String_Node_Str" + pkgName + "String_Node_Str"+ procName+ "String_Node_Str"+ uid+ "String_Node_Str"+ proc);
            pkgState.mProcesses.put(procName,proc);
          }
 else {
            if (DEBUG_PARCEL)             Slog.d(TAG,"String_Node_Str" + pkgName + "String_Node_Str"+ procName+ "String_Node_Str"+ uid+ "String_Node_Str"+ commonProc);
            pkgState.mProcesses.put(procName,commonProc);
          }
        }
        int NSRVS=in.readInt();
        if (NSRVS < 0) {
          mReadError="String_Node_Str" + NSRVS;
          return;
        }
        while (NSRVS > 0) {
          NSRVS--;
          String serviceName=in.readString();
          if (serviceName == null) {
            mReadError="String_Node_Str";
            return;
          }
          String processName=version > 9 ? readCommonString(in,version) : null;
          ServiceState serv=hadData ? pkgState.mServices.get(serviceName) : null;
          if (serv == null) {
            serv=new ServiceState(this,pkgName,serviceName,processName,null);
          }
          if (!serv.readFromParcel(in)) {
            return;
          }
          if (DEBUG_PARCEL)           Slog.d(TAG,"String_Node_Str" + pkgName + "String_Node_Str"+ serviceName+ "String_Node_Str"+ uid+ "String_Node_Str"+ serv);
          pkgState.mServices.put(serviceName,serv);
        }
      }
    }
  }
  mIndexToCommonString=null;
  if (DEBUG_PARCEL)   Slog.d(TAG,"String_Node_Str");
}