Program: 7935
Project: 7935
Buggy source:
private void updateHeader(int firstVisiblePosition){
  if (mHeaderPosition == null || mHeaderPosition != firstVisiblePosition) {
    mHeaderPosition=firstVisiblePosition;
    final long headerId=mAdapter.getHeaderId(firstVisiblePosition);
    if (mHeaderId == null || mHeaderId != headerId) {
      mHeaderId=headerId;
      final View header=mAdapter.getHeaderView(mHeaderPosition,mHeader,this);
      if (mHeader != header) {
        if (header == null) {
          throw new NullPointerException("String_Node_Str");
        }
        swapHeader(header);
      }
      final int width=getWidth() - mPaddingLeft - mPaddingRight;
      final int parentWidthMeasureSpec=MeasureSpec.makeMeasureSpec(width,MeasureSpec.EXACTLY);
      final int parentHeightMeasureSpec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
      measureChild(mHeader,parentWidthMeasureSpec,parentHeightMeasureSpec);
      mHeaderOffset=null;
    }
  }
  int headerOffset=0;
  int headerBottom=mHeader.getMeasuredHeight() + (mClippingToPadding ? mPaddingTop : 0);
  for (int i=1; i < mList.getChildCount(); i++) {
    final View child=mList.getChildAt(i);
    final boolean doesChildHaveHeader=child instanceof WrapperView && ((WrapperView)child).hasHeader();
    final boolean isChildFooter=mList.containsFooterView(child);
    if (doesChildHaveHeader || isChildFooter) {
      headerOffset=Math.min(child.getTop() - headerBottom,0);
      break;
    }
  }
  headerOffset+=mClippingToPadding ? mPaddingTop : 0;
  setHeaderOffet(headerOffset);
  if (!mIsDrawingListUnderStickyHeader) {
    mList.setTopClippingLength(mHeader.getMeasuredHeight() + mHeaderOffset);
  }
  updateHeaderVisibilities();
}

Fixed version (ground truth):
private void updateHeader(int firstVisiblePosition){
  if (mHeaderPosition == null || mHeaderPosition != firstVisiblePosition) {
    mHeaderPosition=firstVisiblePosition;
    final long headerId=mAdapter.getHeaderId(firstVisiblePosition);
    if (mHeaderId == null || mHeaderId != headerId) {
      mHeaderId=headerId;
      final View header=mAdapter.getHeaderView(mHeaderPosition,mHeader,this);
      if (mHeader != header) {
        if (header == null) {
          throw new NullPointerException("String_Node_Str");
        }
        swapHeader(header);
      }
      final int width=getWidth();
      final int parentWidthMeasureSpec=MeasureSpec.makeMeasureSpec(width,MeasureSpec.EXACTLY);
      final int parentHeightMeasureSpec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
      measureChild(mHeader,parentWidthMeasureSpec,parentHeightMeasureSpec);
      mHeaderOffset=null;
    }
  }
  int headerOffset=0;
  int headerBottom=mHeader.getMeasuredHeight() + (mClippingToPadding ? mPaddingTop : 0);
  for (int i=1; i < mList.getChildCount(); i++) {
    final View child=mList.getChildAt(i);
    final boolean doesChildHaveHeader=child instanceof WrapperView && ((WrapperView)child).hasHeader();
    final boolean isChildFooter=mList.containsFooterView(child);
    if (doesChildHaveHeader || isChildFooter) {
      headerOffset=Math.min(child.getTop() - headerBottom,0);
      break;
    }
  }
  headerOffset+=mClippingToPadding ? mPaddingTop : 0;
  setHeaderOffet(headerOffset);
  if (!mIsDrawingListUnderStickyHeader) {
    mList.setTopClippingLength(mHeader.getMeasuredHeight() + mHeaderOffset);
  }
  updateHeaderVisibilities();
}