Program: 110436
Project: 110436
Buggy source:
private void processManifest(MediaPresentationDescription manifest){
  Period firstPeriod=manifest.periods.get(0);
  while (periodHolders.size() > 0 && periodHolders.valueAt(0).startTimeUs < firstPeriod.startMs * 1000) {
    PeriodHolder periodHolder=periodHolders.valueAt(0);
    periodHolders.remove(periodHolder.manifestIndex);
  }
  int periodIndex=0;
  for (int i=0; i < manifest.periods.size(); i++) {
    Period period=manifest.periods.get(i);
    AdaptationSet adaptationSet=period.adaptationSets.get(adaptationSetIndex);
    List<Representation> representations=adaptationSet.representations;
    Representation newRepresentations[];
    if (representationIndices == null) {
      newRepresentations=new Representation[representations.size()];
      representations.toArray(newRepresentations);
    }
 else {
      newRepresentations=new Representation[representationIndices.length];
      for (int j=0; j < representationIndices.length; j++) {
        newRepresentations[j]=representations.get(representationIndices[j]);
      }
    }
    PeriodHolder periodHolder=periodHolders.valueAt(periodIndex);
    if (periodHolder == null) {
      long periodStartUs=period.startMs * 1000;
      periodHolder=new PeriodHolder(periodHolderNextIndex,periodStartUs,newRepresentations);
      periodHolders.put(periodHolderNextIndex,periodHolder);
      periodHolderNextIndex++;
    }
 else {
      for (int j=0; j < newRepresentations.length; j++) {
        RepresentationHolder representationHolder=periodHolder.representationHolders.get(newRepresentations[j].format.id);
        try {
          representationHolder.updateRepresentation(newRepresentations[j]);
        }
 catch (        BehindLiveWindowException e) {
          fatalError=e;
          return;
        }
      }
    }
    periodIndex++;
  }
  currentManifest=manifest;
}

Fixed version (ground truth):
private void processManifest(MediaPresentationDescription manifest){
  Period firstPeriod=manifest.periods.get(0);
  while (periodHolders.size() > 0 && periodHolders.valueAt(0).startTimeUs < firstPeriod.startMs * 1000) {
    PeriodHolder periodHolder=periodHolders.valueAt(0);
    periodHolders.remove(periodHolder.manifestIndex);
  }
  for (int i=0; i < manifest.periods.size(); i++) {
    Period period=manifest.periods.get(i);
    AdaptationSet adaptationSet=period.adaptationSets.get(adaptationSetIndex);
    List<Representation> representations=adaptationSet.representations;
    Representation newRepresentations[];
    if (representationIndices == null) {
      newRepresentations=new Representation[representations.size()];
      representations.toArray(newRepresentations);
    }
 else {
      newRepresentations=new Representation[representationIndices.length];
      for (int j=0; j < representationIndices.length; j++) {
        newRepresentations[j]=representations.get(representationIndices[j]);
      }
    }
    if (i < periodHolders.size()) {
      PeriodHolder periodHolder=periodHolders.valueAt(i);
      for (int j=0; j < newRepresentations.length; j++) {
        RepresentationHolder representationHolder=periodHolder.representationHolders.get(newRepresentations[j].format.id);
        try {
          representationHolder.updateRepresentation(newRepresentations[j]);
        }
 catch (        BehindLiveWindowException e) {
          fatalError=e;
          return;
        }
      }
    }
 else {
      long periodStartUs=period.startMs * 1000;
      PeriodHolder periodHolder=new PeriodHolder(periodHolderNextIndex,periodStartUs,newRepresentations);
      periodHolders.put(periodHolderNextIndex,periodHolder);
      periodHolderNextIndex++;
    }
  }
  currentManifest=manifest;
}