Program: 7960
Project: 7960
Buggy source:
private void scrollChanged(int firstVisibleItem){
  if (getAdapter() == null || getAdapter().getCount() == 0)   return;
  if (areHeadersSticky) {
    if (getChildCount() != 0) {
      View viewToWatch=super.getChildAt(0);
      for (int i=1; i < getChildCount(); i++) {
        int firstChildDistance;
        if (clippingToPadding) {
          firstChildDistance=Math.abs((viewToWatch.getTop() - getPaddingTop()));
        }
 else {
          firstChildDistance=Math.abs(viewToWatch.getTop());
        }
        int secondChildDistance;
        if (clippingToPadding) {
          secondChildDistance=Math.abs((super.getChildAt(i).getTop() - getPaddingTop()) - headerHeight);
        }
 else {
          secondChildDistance=Math.abs(super.getChildAt(i).getTop() - headerHeight);
        }
        if (!(Boolean)viewToWatch.getTag() || ((Boolean)super.getChildAt(i).getTag() && secondChildDistance < firstChildDistance)) {
          viewToWatch=super.getChildAt(i);
        }
      }
      if ((Boolean)viewToWatch.getTag()) {
        if (headerHeight < 0)         headerHeight=viewToWatch.findViewById(R.id.__stickylistheaders_header_view).getHeight();
        if (firstVisibleItem == 0 && super.getChildAt(0).getTop() > 0 && !clippingToPadding) {
          headerBottomPosition=0;
        }
 else {
          if (clippingToPadding) {
            headerBottomPosition=Math.min(viewToWatch.getTop(),headerHeight + getPaddingTop());
            headerBottomPosition=headerBottomPosition < getPaddingTop() ? headerHeight + getPaddingTop() : headerBottomPosition;
          }
 else {
            headerBottomPosition=Math.min(viewToWatch.getTop(),headerHeight);
            headerBottomPosition=headerBottomPosition < 0 ? headerHeight : headerBottomPosition;
          }
        }
      }
 else {
        headerBottomPosition=headerHeight;
        if (clippingToPadding) {
          headerBottomPosition+=getPaddingTop();
        }
      }
    }
    if (Build.VERSION.SDK_INT < 11) {
      if (!clippingToPadding && getPaddingTop() > 0) {
        if (super.getChildAt(0).getTop() > 0) {
          if (firstVisibleItem > 0)           firstVisibleItem-=1;
        }
      }
    }
    long currentHeaderId=((StickyListHeadersAdapter)getAdapter()).getHeaderId(firstVisibleItem);
    if (oldHeaderId == null || oldHeaderId != currentHeaderId) {
      headerHasChanged=true;
      header=((StickyListHeadersAdapter)getAdapter()).getHeaderView(firstVisibleItem,header);
      header.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,headerHeight));
    }
    oldHeaderId=currentHeaderId;
    for (int i=0; i < getChildCount(); i++) {
      if ((Boolean)super.getChildAt(i).getTag()) {
        if (super.getChildAt(i).getTop() < (clippingToPadding ? getPaddingTop() : 0)) {
          super.getChildAt(i).findViewById(R.id.__stickylistheaders_header_view).setVisibility(View.INVISIBLE);
        }
 else {
          super.getChildAt(i).findViewById(R.id.__stickylistheaders_header_view).setVisibility(View.VISIBLE);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void scrollChanged(int firstVisibleItem){
  if (getAdapter() == null || getAdapter().getCount() == 0)   return;
  firstVisibleItem=getFixedFirstVisibleItem(firstVisibleItem);
  if (areHeadersSticky) {
    if (getChildCount() != 0) {
      View viewToWatch=super.getChildAt(0);
      for (int i=1; i < getChildCount(); i++) {
        int firstChildDistance;
        if (clippingToPadding) {
          firstChildDistance=Math.abs((viewToWatch.getTop() - getPaddingTop()));
        }
 else {
          firstChildDistance=Math.abs(viewToWatch.getTop());
        }
        int secondChildDistance;
        if (clippingToPadding) {
          secondChildDistance=Math.abs((super.getChildAt(i).getTop() - getPaddingTop()) - headerHeight);
        }
 else {
          secondChildDistance=Math.abs(super.getChildAt(i).getTop() - headerHeight);
        }
        if (!(Boolean)viewToWatch.getTag() || ((Boolean)super.getChildAt(i).getTag() && secondChildDistance < firstChildDistance)) {
          viewToWatch=super.getChildAt(i);
        }
      }
      if ((Boolean)viewToWatch.getTag()) {
        if (headerHeight < 0)         headerHeight=viewToWatch.findViewById(R.id.__stickylistheaders_header_view).getHeight();
        if (firstVisibleItem == 0 && super.getChildAt(0).getTop() > 0 && !clippingToPadding) {
          headerBottomPosition=0;
        }
 else {
          if (clippingToPadding) {
            headerBottomPosition=Math.min(viewToWatch.getTop(),headerHeight + getPaddingTop());
            headerBottomPosition=headerBottomPosition < getPaddingTop() ? headerHeight + getPaddingTop() : headerBottomPosition;
          }
 else {
            headerBottomPosition=Math.min(viewToWatch.getTop(),headerHeight);
            headerBottomPosition=headerBottomPosition < 0 ? headerHeight : headerBottomPosition;
          }
        }
      }
 else {
        headerBottomPosition=headerHeight;
        if (clippingToPadding) {
          headerBottomPosition+=getPaddingTop();
        }
      }
    }
    long currentHeaderId=((StickyListHeadersAdapter)getAdapter()).getHeaderId(firstVisibleItem);
    if (oldHeaderId == null || oldHeaderId != currentHeaderId) {
      headerHasChanged=true;
      header=((StickyListHeadersAdapter)getAdapter()).getHeaderView(firstVisibleItem,header);
      header.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,headerHeight));
    }
    oldHeaderId=currentHeaderId;
    for (int i=0; i < getChildCount(); i++) {
      if ((Boolean)super.getChildAt(i).getTag()) {
        if (super.getChildAt(i).getTop() < (clippingToPadding ? getPaddingTop() : 0)) {
          super.getChildAt(i).findViewById(R.id.__stickylistheaders_header_view).setVisibility(View.INVISIBLE);
        }
 else {
          super.getChildAt(i).findViewById(R.id.__stickylistheaders_header_view).setVisibility(View.VISIBLE);
        }
      }
    }
  }
}