Program: 199859
Project: 199859
Buggy source:
private void readSummaryFromParcel(Parcel in){
  final int version=in.readInt();
  if (version != VERSION) {
    Slog.w("String_Node_Str","String_Node_Str" + version + "String_Node_Str"+ VERSION+ "String_Node_Str");
    return;
  }
  readHistory(in,true);
  mStartCount=in.readInt();
  mBatteryUptime=in.readLong();
  mBatteryRealtime=in.readLong();
  mUptime=in.readLong();
  mRealtime=in.readLong();
  mStartClockTime=in.readLong();
  mDischargeUnplugLevel=in.readInt();
  mDischargeCurrentLevel=in.readInt();
  mLowDischargeAmountSinceCharge=in.readInt();
  mHighDischargeAmountSinceCharge=in.readInt();
  mDischargeAmountScreenOnSinceCharge=in.readInt();
  mDischargeAmountScreenOffSinceCharge=in.readInt();
  mStartCount++;
  mScreenOn=false;
  mScreenOnTimer.readSummaryFromParcelLocked(in);
  for (int i=0; i < NUM_SCREEN_BRIGHTNESS_BINS; i++) {
    mScreenBrightnessTimer[i].readSummaryFromParcelLocked(in);
  }
  mInputEventCounter.readSummaryFromParcelLocked(in);
  mPhoneOn=false;
  mPhoneOnTimer.readSummaryFromParcelLocked(in);
  for (int i=0; i < SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
    mPhoneSignalStrengthsTimer[i].readSummaryFromParcelLocked(in);
  }
  mPhoneSignalScanningTimer.readSummaryFromParcelLocked(in);
  for (int i=0; i < NUM_DATA_CONNECTION_TYPES; i++) {
    mPhoneDataConnectionsTimer[i].readSummaryFromParcelLocked(in);
  }
  for (int i=0; i < NUM_NETWORK_ACTIVITY_TYPES; i++) {
    mNetworkByteActivityCounters[i].readSummaryFromParcelLocked(in);
    mNetworkPacketActivityCounters[i].readSummaryFromParcelLocked(in);
  }
  mMobileRadioActive=false;
  mMobileRadioActiveTimer.readSummaryFromParcelLocked(in);
  mWifiOn=false;
  mWifiOnTimer.readSummaryFromParcelLocked(in);
  mGlobalWifiRunning=false;
  mGlobalWifiRunningTimer.readSummaryFromParcelLocked(in);
  for (int i=0; i < NUM_WIFI_STATES; i++) {
    mWifiStateTimer[i].readSummaryFromParcelLocked(in);
  }
  mBluetoothOn=false;
  mBluetoothOnTimer.readSummaryFromParcelLocked(in);
  for (int i=0; i < NUM_BLUETOOTH_STATES; i++) {
    mBluetoothStateTimer[i].readSummaryFromParcelLocked(in);
  }
  int NKW=in.readInt();
  if (NKW > 10000) {
    Slog.w(TAG,"String_Node_Str" + NKW);
    return;
  }
  for (int ikw=0; ikw < NKW; ikw++) {
    if (in.readInt() != 0) {
      String kwltName=in.readString();
      getKernelWakelockTimerLocked(kwltName).readSummaryFromParcelLocked(in);
    }
  }
  sNumSpeedSteps=in.readInt();
  final int NU=in.readInt();
  if (NU > 10000) {
    Slog.w(TAG,"String_Node_Str" + NU);
    return;
  }
  for (int iu=0; iu < NU; iu++) {
    int uid=in.readInt();
    Uid u=new Uid(uid);
    mUidStats.put(uid,u);
    u.mWifiRunning=false;
    if (in.readInt() != 0) {
      u.mWifiRunningTimer.readSummaryFromParcelLocked(in);
    }
    u.mFullWifiLockOut=false;
    if (in.readInt() != 0) {
      u.mFullWifiLockTimer.readSummaryFromParcelLocked(in);
    }
    u.mWifiScanStarted=false;
    if (in.readInt() != 0) {
      u.mWifiScanTimer.readSummaryFromParcelLocked(in);
    }
    u.mWifiBatchedScanBinStarted=Uid.NO_BATCHED_SCAN_STARTED;
    for (int i=0; i < Uid.NUM_WIFI_BATCHED_SCAN_BINS; i++) {
      if (in.readInt() != 0) {
        u.makeWifiBatchedScanBin(i,null);
        u.mWifiBatchedScanTimer[i].readSummaryFromParcelLocked(in);
      }
    }
    u.mWifiMulticastEnabled=false;
    if (in.readInt() != 0) {
      u.mWifiMulticastTimer.readSummaryFromParcelLocked(in);
    }
    u.mAudioTurnedOn=false;
    if (in.readInt() != 0) {
      u.createAudioTurnedOnTimerLocked().readSummaryFromParcelLocked(in);
    }
    u.mVideoTurnedOn=false;
    if (in.readInt() != 0) {
      u.createVideoTurnedOnTimerLocked().readSummaryFromParcelLocked(in);
    }
    if (in.readInt() != 0) {
      u.createForegroundActivityTimerLocked().readSummaryFromParcelLocked(in);
    }
    if (in.readInt() != 0) {
      u.createVibratorOnTimerLocked().readSummaryFromParcelLocked(in);
    }
    if (in.readInt() != 0) {
      if (u.mUserActivityCounters == null) {
        u.initUserActivityLocked();
      }
      for (int i=0; i < Uid.NUM_USER_ACTIVITY_TYPES; i++) {
        u.mUserActivityCounters[i].readSummaryFromParcelLocked(in);
      }
    }
    if (in.readInt() != 0) {
      if (u.mNetworkByteActivityCounters == null) {
        u.initNetworkActivityLocked();
      }
      for (int i=0; i < NUM_NETWORK_ACTIVITY_TYPES; i++) {
        u.mNetworkByteActivityCounters[i].readSummaryFromParcelLocked(in);
        u.mNetworkPacketActivityCounters[i].readSummaryFromParcelLocked(in);
      }
    }
    int NW=in.readInt();
    if (NW > 100) {
      Slog.w(TAG,"String_Node_Str" + NW);
      return;
    }
    for (int iw=0; iw < NW; iw++) {
      String wlName=in.readString();
      if (in.readInt() != 0) {
        u.getWakeTimerLocked(wlName,WAKE_TYPE_FULL).readSummaryFromParcelLocked(in);
      }
      if (in.readInt() != 0) {
        u.getWakeTimerLocked(wlName,WAKE_TYPE_PARTIAL).readSummaryFromParcelLocked(in);
      }
      if (in.readInt() != 0) {
        u.getWakeTimerLocked(wlName,WAKE_TYPE_WINDOW).readSummaryFromParcelLocked(in);
      }
    }
    int NP=in.readInt();
    if (NP > 1000) {
      Slog.w(TAG,"String_Node_Str" + NP);
      return;
    }
    for (int is=0; is < NP; is++) {
      int seNumber=in.readInt();
      if (in.readInt() != 0) {
        u.getSensorTimerLocked(seNumber,true).readSummaryFromParcelLocked(in);
      }
    }
    NP=in.readInt();
    if (NP > 1000) {
      Slog.w(TAG,"String_Node_Str" + NP);
      return;
    }
    for (int ip=0; ip < NP; ip++) {
      String procName=in.readString();
      Uid.Proc p=u.getProcessStatsLocked(procName);
      p.mUserTime=p.mLoadedUserTime=in.readLong();
      p.mSystemTime=p.mLoadedSystemTime=in.readLong();
      p.mForegroundTime=p.mLoadedForegroundTime=in.readLong();
      p.mStarts=p.mLoadedStarts=in.readInt();
      int NSB=in.readInt();
      if (NSB > 100) {
        Slog.w(TAG,"String_Node_Str" + NSB);
        return;
      }
      p.mSpeedBins=new SamplingCounter[NSB];
      for (int i=0; i < NSB; i++) {
        if (in.readInt() != 0) {
          p.mSpeedBins[i]=new SamplingCounter(mUnpluggables);
          p.mSpeedBins[i].readSummaryFromParcelLocked(in);
        }
      }
      if (!p.readExcessivePowerFromParcelLocked(in)) {
        return;
      }
    }
    NP=in.readInt();
    if (NP > 10000) {
      Slog.w(TAG,"String_Node_Str" + NP);
      return;
    }
    for (int ip=0; ip < NP; ip++) {
      String pkgName=in.readString();
      Uid.Pkg p=u.getPackageStatsLocked(pkgName);
      p.mWakeups=p.mLoadedWakeups=in.readInt();
      final int NS=in.readInt();
      if (NS > 1000) {
        Slog.w(TAG,"String_Node_Str" + NS);
        return;
      }
      for (int is=0; is < NS; is++) {
        String servName=in.readString();
        Uid.Pkg.Serv s=u.getServiceStatsLocked(pkgName,servName);
        s.mStartTime=s.mLoadedStartTime=in.readLong();
        s.mStarts=s.mLoadedStarts=in.readInt();
        s.mLaunches=s.mLoadedLaunches=in.readInt();
      }
    }
  }
}

Fixed version (ground truth):
private void readSummaryFromParcel(Parcel in){
  final int version=in.readInt();
  if (version != VERSION) {
    Slog.w("String_Node_Str","String_Node_Str" + version + "String_Node_Str"+ VERSION+ "String_Node_Str");
    return;
  }
  readHistory(in,true);
  mStartCount=in.readInt();
  mBatteryUptime=in.readLong();
  mBatteryRealtime=in.readLong();
  mUptime=in.readLong();
  mRealtime=in.readLong();
  mStartClockTime=in.readLong();
  mDischargeUnplugLevel=in.readInt();
  mDischargeCurrentLevel=in.readInt();
  mLowDischargeAmountSinceCharge=in.readInt();
  mHighDischargeAmountSinceCharge=in.readInt();
  mDischargeAmountScreenOnSinceCharge=in.readInt();
  mDischargeAmountScreenOffSinceCharge=in.readInt();
  mStartCount++;
  mScreenOn=false;
  mScreenOnTimer.readSummaryFromParcelLocked(in);
  for (int i=0; i < NUM_SCREEN_BRIGHTNESS_BINS; i++) {
    mScreenBrightnessTimer[i].readSummaryFromParcelLocked(in);
  }
  mInputEventCounter.readSummaryFromParcelLocked(in);
  mPhoneOn=false;
  mPhoneOnTimer.readSummaryFromParcelLocked(in);
  for (int i=0; i < SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
    mPhoneSignalStrengthsTimer[i].readSummaryFromParcelLocked(in);
  }
  mPhoneSignalScanningTimer.readSummaryFromParcelLocked(in);
  for (int i=0; i < NUM_DATA_CONNECTION_TYPES; i++) {
    mPhoneDataConnectionsTimer[i].readSummaryFromParcelLocked(in);
  }
  for (int i=0; i < NUM_NETWORK_ACTIVITY_TYPES; i++) {
    mNetworkByteActivityCounters[i].readSummaryFromParcelLocked(in);
    mNetworkPacketActivityCounters[i].readSummaryFromParcelLocked(in);
  }
  mMobileRadioActive=false;
  mMobileRadioActiveTimer.readSummaryFromParcelLocked(in);
  mWifiOn=false;
  mWifiOnTimer.readSummaryFromParcelLocked(in);
  mGlobalWifiRunning=false;
  mGlobalWifiRunningTimer.readSummaryFromParcelLocked(in);
  for (int i=0; i < NUM_WIFI_STATES; i++) {
    mWifiStateTimer[i].readSummaryFromParcelLocked(in);
  }
  mBluetoothOn=false;
  mBluetoothOnTimer.readSummaryFromParcelLocked(in);
  for (int i=0; i < NUM_BLUETOOTH_STATES; i++) {
    mBluetoothStateTimer[i].readSummaryFromParcelLocked(in);
  }
  int NKW=in.readInt();
  if (NKW > 10000) {
    Slog.w(TAG,"String_Node_Str" + NKW);
    return;
  }
  for (int ikw=0; ikw < NKW; ikw++) {
    if (in.readInt() != 0) {
      String kwltName=in.readString();
      getKernelWakelockTimerLocked(kwltName).readSummaryFromParcelLocked(in);
    }
  }
  sNumSpeedSteps=in.readInt();
  if (sNumSpeedSteps < 0 || sNumSpeedSteps > 100) {
    throw new BadParcelableException("String_Node_Str" + sNumSpeedSteps);
  }
  final int NU=in.readInt();
  if (NU > 10000) {
    Slog.w(TAG,"String_Node_Str" + NU);
    return;
  }
  for (int iu=0; iu < NU; iu++) {
    int uid=in.readInt();
    Uid u=new Uid(uid);
    mUidStats.put(uid,u);
    u.mWifiRunning=false;
    if (in.readInt() != 0) {
      u.mWifiRunningTimer.readSummaryFromParcelLocked(in);
    }
    u.mFullWifiLockOut=false;
    if (in.readInt() != 0) {
      u.mFullWifiLockTimer.readSummaryFromParcelLocked(in);
    }
    u.mWifiScanStarted=false;
    if (in.readInt() != 0) {
      u.mWifiScanTimer.readSummaryFromParcelLocked(in);
    }
    u.mWifiBatchedScanBinStarted=Uid.NO_BATCHED_SCAN_STARTED;
    for (int i=0; i < Uid.NUM_WIFI_BATCHED_SCAN_BINS; i++) {
      if (in.readInt() != 0) {
        u.makeWifiBatchedScanBin(i,null);
        u.mWifiBatchedScanTimer[i].readSummaryFromParcelLocked(in);
      }
    }
    u.mWifiMulticastEnabled=false;
    if (in.readInt() != 0) {
      u.mWifiMulticastTimer.readSummaryFromParcelLocked(in);
    }
    u.mAudioTurnedOn=false;
    if (in.readInt() != 0) {
      u.createAudioTurnedOnTimerLocked().readSummaryFromParcelLocked(in);
    }
    u.mVideoTurnedOn=false;
    if (in.readInt() != 0) {
      u.createVideoTurnedOnTimerLocked().readSummaryFromParcelLocked(in);
    }
    if (in.readInt() != 0) {
      u.createForegroundActivityTimerLocked().readSummaryFromParcelLocked(in);
    }
    if (in.readInt() != 0) {
      u.createVibratorOnTimerLocked().readSummaryFromParcelLocked(in);
    }
    if (in.readInt() != 0) {
      if (u.mUserActivityCounters == null) {
        u.initUserActivityLocked();
      }
      for (int i=0; i < Uid.NUM_USER_ACTIVITY_TYPES; i++) {
        u.mUserActivityCounters[i].readSummaryFromParcelLocked(in);
      }
    }
    if (in.readInt() != 0) {
      if (u.mNetworkByteActivityCounters == null) {
        u.initNetworkActivityLocked();
      }
      for (int i=0; i < NUM_NETWORK_ACTIVITY_TYPES; i++) {
        u.mNetworkByteActivityCounters[i].readSummaryFromParcelLocked(in);
        u.mNetworkPacketActivityCounters[i].readSummaryFromParcelLocked(in);
      }
    }
    int NW=in.readInt();
    if (NW > 100) {
      Slog.w(TAG,"String_Node_Str" + NW);
      return;
    }
    for (int iw=0; iw < NW; iw++) {
      String wlName=in.readString();
      if (in.readInt() != 0) {
        u.getWakeTimerLocked(wlName,WAKE_TYPE_FULL).readSummaryFromParcelLocked(in);
      }
      if (in.readInt() != 0) {
        u.getWakeTimerLocked(wlName,WAKE_TYPE_PARTIAL).readSummaryFromParcelLocked(in);
      }
      if (in.readInt() != 0) {
        u.getWakeTimerLocked(wlName,WAKE_TYPE_WINDOW).readSummaryFromParcelLocked(in);
      }
    }
    int NP=in.readInt();
    if (NP > 1000) {
      Slog.w(TAG,"String_Node_Str" + NP);
      return;
    }
    for (int is=0; is < NP; is++) {
      int seNumber=in.readInt();
      if (in.readInt() != 0) {
        u.getSensorTimerLocked(seNumber,true).readSummaryFromParcelLocked(in);
      }
    }
    NP=in.readInt();
    if (NP > 1000) {
      Slog.w(TAG,"String_Node_Str" + NP);
      return;
    }
    for (int ip=0; ip < NP; ip++) {
      String procName=in.readString();
      Uid.Proc p=u.getProcessStatsLocked(procName);
      p.mUserTime=p.mLoadedUserTime=in.readLong();
      p.mSystemTime=p.mLoadedSystemTime=in.readLong();
      p.mForegroundTime=p.mLoadedForegroundTime=in.readLong();
      p.mStarts=p.mLoadedStarts=in.readInt();
      int NSB=in.readInt();
      if (NSB > 100) {
        Slog.w(TAG,"String_Node_Str" + NSB);
        return;
      }
      p.mSpeedBins=new SamplingCounter[NSB];
      for (int i=0; i < NSB; i++) {
        if (in.readInt() != 0) {
          p.mSpeedBins[i]=new SamplingCounter(mUnpluggables);
          p.mSpeedBins[i].readSummaryFromParcelLocked(in);
        }
      }
      if (!p.readExcessivePowerFromParcelLocked(in)) {
        return;
      }
    }
    NP=in.readInt();
    if (NP > 10000) {
      Slog.w(TAG,"String_Node_Str" + NP);
      return;
    }
    for (int ip=0; ip < NP; ip++) {
      String pkgName=in.readString();
      Uid.Pkg p=u.getPackageStatsLocked(pkgName);
      p.mWakeups=p.mLoadedWakeups=in.readInt();
      final int NS=in.readInt();
      if (NS > 1000) {
        Slog.w(TAG,"String_Node_Str" + NS);
        return;
      }
      for (int is=0; is < NS; is++) {
        String servName=in.readString();
        Uid.Pkg.Serv s=u.getServiceStatsLocked(pkgName,servName);
        s.mStartTime=s.mLoadedStartTime=in.readLong();
        s.mStarts=s.mLoadedStarts=in.readInt();
        s.mLaunches=s.mLoadedLaunches=in.readInt();
      }
    }
  }
}