Program: 110305
Project: 110305
Buggy source:
private void onMoovContainerAtomRead(ContainerAtom moov) throws ParserException {
  Assertions.checkState(sideloadedTrack == null,"String_Node_Str");
  DrmInitData drmInitData=getDrmInitDataFromAtoms(moov.leafChildren);
  ContainerAtom mvex=moov.getContainerAtomOfType(Atom.TYPE_mvex);
  SparseArray<DefaultSampleValues> defaultSampleValuesArray=new SparseArray<>();
  long duration=C.TIME_UNSET;
  int mvexChildrenSize=mvex.leafChildren.size();
  for (int i=0; i < mvexChildrenSize; i++) {
    Atom.LeafAtom atom=mvex.leafChildren.get(i);
    if (atom.type == Atom.TYPE_trex) {
      Pair<Integer,DefaultSampleValues> trexData=parseTrex(atom.data);
      defaultSampleValuesArray.put(trexData.first,trexData.second);
    }
 else     if (atom.type == Atom.TYPE_mehd) {
      duration=parseMehd(atom.data);
    }
  }
  SparseArray<Track> tracks=new SparseArray<>();
  int moovContainerChildrenSize=moov.containerChildren.size();
  for (int i=0; i < moovContainerChildrenSize; i++) {
    Atom.ContainerAtom atom=moov.containerChildren.get(i);
    if (atom.type == Atom.TYPE_trak) {
      Track track=AtomParsers.parseTrak(atom,moov.getLeafAtomOfType(Atom.TYPE_mvhd),duration,drmInitData,false);
      if (track != null) {
        tracks.put(track.id,track);
      }
    }
  }
  int trackCount=tracks.size();
  if (trackBundles.size() == 0) {
    for (int i=0; i < trackCount; i++) {
      Track track=tracks.valueAt(i);
      trackBundles.put(track.id,new TrackBundle(extractorOutput.track(i)));
      durationUs=Math.max(durationUs,track.durationUs);
    }
    maybeInitExtraTracks();
    extractorOutput.endTracks();
  }
 else {
    Assertions.checkState(trackBundles.size() == trackCount);
  }
  for (int i=0; i < trackCount; i++) {
    Track track=tracks.valueAt(i);
    trackBundles.get(track.id).init(track,defaultSampleValuesArray.get(track.id));
  }
}

Fixed version (ground truth):
private void onMoovContainerAtomRead(ContainerAtom moov) throws ParserException {
  Assertions.checkState(sideloadedTrack == null,"String_Node_Str");
  DrmInitData drmInitData=getDrmInitDataFromAtoms(moov.leafChildren);
  ContainerAtom mvex=moov.getContainerAtomOfType(Atom.TYPE_mvex);
  SparseArray<DefaultSampleValues> defaultSampleValuesArray=new SparseArray<>();
  long duration=C.TIME_UNSET;
  int mvexChildrenSize=mvex.leafChildren.size();
  for (int i=0; i < mvexChildrenSize; i++) {
    Atom.LeafAtom atom=mvex.leafChildren.get(i);
    if (atom.type == Atom.TYPE_trex) {
      Pair<Integer,DefaultSampleValues> trexData=parseTrex(atom.data);
      defaultSampleValuesArray.put(trexData.first,trexData.second);
    }
 else     if (atom.type == Atom.TYPE_mehd) {
      duration=parseMehd(atom.data);
    }
  }
  SparseArray<Track> tracks=new SparseArray<>();
  int moovContainerChildrenSize=moov.containerChildren.size();
  for (int i=0; i < moovContainerChildrenSize; i++) {
    Atom.ContainerAtom atom=moov.containerChildren.get(i);
    if (atom.type == Atom.TYPE_trak) {
      Track track=AtomParsers.parseTrak(atom,moov.getLeafAtomOfType(Atom.TYPE_mvhd),duration,drmInitData,false);
      if (track != null) {
        tracks.put(track.id,track);
      }
    }
  }
  int trackCount=tracks.size();
  if (trackBundles.size() == 0) {
    for (int i=0; i < trackCount; i++) {
      Track track=tracks.valueAt(i);
      TrackBundle trackBundle=new TrackBundle(extractorOutput.track(i));
      trackBundle.init(track,defaultSampleValuesArray.get(track.id));
      trackBundles.put(track.id,trackBundle);
      durationUs=Math.max(durationUs,track.durationUs);
    }
    maybeInitExtraTracks();
    extractorOutput.endTracks();
  }
 else {
    Assertions.checkState(trackBundles.size() == trackCount);
    for (int i=0; i < trackCount; i++) {
      Track track=tracks.valueAt(i);
      trackBundles.get(track.id).init(track,defaultSampleValuesArray.get(track.id));
    }
  }
}