Program: 75774
Project: 75774
Buggy source:
protected IReportItemExecutor prepareChildExecutor() throws Exception {
  if (fragment == null && nextOffset == -1) {
    if (!firstChild) {
      return null;
    }
    firstChild=false;
    DocumentExtension docExt=(DocumentExtension)content.getExtension(IContent.DOCUMENT_EXTENSION);
    if (docExt != null) {
      nextOffset=docExt.getFirstChild();
    }
  }
  if (fragment != null) {
    if (sections == null) {
      sections=fragment.getSections();
      nextSection=-1;
      useNextSection=true;
    }
    if (useNextSection) {
      useNextSection=false;
      nextSection++;
      if (sections == null || nextSection >= sections.length) {
        return null;
      }
      Object leftEdge=sections[nextSection][0];
      if (leftEdge == Segment.LEFT_MOST_EDGE) {
        DocumentExtension docExt=(DocumentExtension)content.getExtension(IContent.DOCUMENT_EXTENSION);
        if (docExt != null) {
          nextOffset=docExt.getFirstChild();
        }
      }
 else {
        InstanceIndex leftIndex=(InstanceIndex)leftEdge;
        InstanceID leftId=leftIndex.getInstanceID();
        nextOffset=leftIndex.getOffset();
        uniqueId=leftId.getUniqueID();
      }
    }
  }
  ReportItemExecutor childExecutor=doCreateExecutor(nextOffset);
  if (childExecutor != null) {
    IContent childContent=childExecutor.execute();
    if (childContent != null) {
      if (fragment != null) {
        InstanceID childId=childContent.getInstanceID();
        Fragment childFragment=fragment.getFragment(childId);
        if (childFragment != null) {
          childExecutor.setFragment(childFragment);
        }
        Object rightEdge=sections[nextSection][1];
        if (rightEdge != Segment.RIGHT_MOST_EDGE) {
          InstanceIndex rightIndex=(InstanceIndex)rightEdge;
          InstanceID rightId=rightIndex.getInstanceID();
          if (isSameInstance(rightId,childId)) {
            useNextSection=true;
          }
        }
      }
      DocumentExtension docExt=(DocumentExtension)childContent.getExtension(IContent.DOCUMENT_EXTENSION);
      if (docExt != null) {
        nextOffset=docExt.getNext();
      }
    }
  }
  return childExecutor;
}

Fixed version (ground truth):
protected IReportItemExecutor prepareChildExecutor() throws Exception {
  if (prepareFirstChild) {
    if (fragment == null && nextOffset == -1) {
      DocumentExtension docExt=(DocumentExtension)content.getExtension(IContent.DOCUMENT_EXTENSION);
      if (docExt != null) {
        nextOffset=docExt.getFirstChild();
      }
    }
    if (fragment != null) {
      if (sections == null) {
        sections=fragment.getSections();
        nextSection=-1;
        useNextSection=true;
      }
    }
    prepareFirstChild=false;
  }
  if (fragment != null) {
    if (useNextSection) {
      useNextSection=false;
      nextSection++;
      if (sections == null || nextSection >= sections.length) {
        return null;
      }
      Object leftEdge=sections[nextSection][0];
      if (leftEdge == Segment.LEFT_MOST_EDGE) {
        DocumentExtension docExt=(DocumentExtension)content.getExtension(IContent.DOCUMENT_EXTENSION);
        if (docExt != null) {
          nextOffset=docExt.getFirstChild();
        }
      }
 else {
        InstanceIndex leftIndex=(InstanceIndex)leftEdge;
        InstanceID leftId=leftIndex.getInstanceID();
        nextOffset=leftIndex.getOffset();
        uniqueId=leftId.getUniqueID();
      }
    }
  }
  if (nextOffset == -1) {
    return null;
  }
  ReportItemExecutor childExecutor=doCreateExecutor(nextOffset);
  if (childExecutor != null) {
    IContent childContent=childExecutor.execute();
    if (childContent != null) {
      if (fragment != null) {
        InstanceID childId=childContent.getInstanceID();
        Fragment childFragment=fragment.getFragment(childId);
        if (childFragment != null) {
          childExecutor.setFragment(childFragment);
        }
        Object rightEdge=sections[nextSection][1];
        if (rightEdge != Segment.RIGHT_MOST_EDGE) {
          InstanceIndex rightIndex=(InstanceIndex)rightEdge;
          InstanceID rightId=rightIndex.getInstanceID();
          if (isSameInstance(rightId,childId)) {
            useNextSection=true;
          }
        }
      }
      DocumentExtension docExt=(DocumentExtension)childContent.getExtension(IContent.DOCUMENT_EXTENSION);
      if (docExt != null) {
        nextOffset=docExt.getNext();
      }
    }
  }
  return childExecutor;
}