Program: 46921
Project: 46921
Buggy source:
/** 
 * Get the position of the floating item for any view of the list in its current drag state. Result is restricted to positions between header and footer items.
 * @param y y-coord of dragging finger
 * @param position ListView position
 * @param top y-coord of top of item at given position
 */
private int getFloatPosition(int y,int position,int top){
  final int floatViewMidY=Math.max(mFloatViewHeightHalf + getPaddingTop(),Math.min(getHeight() - getPaddingBottom() - mFloatViewHeightHalf,y - mDragPointY + mFloatViewHeightHalf));
  int visItemTop;
  int visItemPos;
  final int divHeight=getDividerHeight();
switch (mDragState) {
case SRC_ABOVE:
    visItemTop=top;
  if (position == mSrcDragPos + 1) {
    visItemTop-=mItemHeightCollapsed + divHeight;
  }
if (position > mSrcDragPos && position <= mExpDragPos) {
  visItemPos=position - 1;
}
 else {
  visItemPos=position;
}
break;
case SRC_BELOW:
visItemTop=top;
if (position == mSrcDragPos) {
visItemTop+=mItemHeightCollapsed + divHeight;
}
if (position < mSrcDragPos && position >= mExpDragPos) {
visItemPos=position + 1;
}
 else {
visItemPos=position;
}
break;
default :
visItemTop=top;
visItemPos=position;
}
int edge=getDragEdge(visItemPos,visItemTop);
if (floatViewMidY < edge) {
while (visItemPos >= 0) {
visItemPos--;
if (visItemPos <= 0) {
visItemPos=0;
break;
}
visItemTop-=getVisualItemHeight(visItemPos);
edge=getDragEdge(visItemPos,visItemTop);
if (floatViewMidY >= edge) {
break;
}
}
}
 else {
final int count=getCount();
while (visItemPos < count) {
if (visItemPos == count - 1) {
break;
}
visItemTop+=getVisualItemHeight(visItemPos);
edge=getDragEdge(visItemPos + 1,visItemTop);
if (floatViewMidY < edge) {
break;
}
visItemPos++;
}
}
final int numHeaders=getHeaderViewsCount();
final int numFooters=getFooterViewsCount();
if (visItemPos < numHeaders) {
return numHeaders;
}
 else if (visItemPos >= getCount() - numFooters) {
return getCount() - numFooters - 1;
}
return visItemPos;
}

Fixed version (ground truth):
/** 
 * Get the position of the floating item for any view of the list in its current drag state. Result is restricted to positions between header and footer items.
 * @param y y-coord of dragging finger
 * @param position ListView position
 * @param top y-coord of top of item at given position
 */
private int getFloatPosition(int y,int position,int top){
  final int floatViewMidY=Math.max(mFloatViewHeightHalf + getPaddingTop(),Math.min(getHeight() - getPaddingBottom() - mFloatViewHeightHalf,y - mDragPointY + mFloatViewHeightHalf));
  int visItemTop;
  int visItemPos;
  final int divHeight=getDividerHeight();
switch (mDragState) {
case SRC_ABOVE:
    visItemTop=top;
  if (position == mSrcDragPos + 1) {
    visItemTop-=mItemHeightCollapsed + divHeight;
  }
if (position > mSrcDragPos && position <= mExpDragPos) {
  visItemPos=position - 1;
}
 else {
  visItemPos=position;
}
break;
case SRC_BELOW:
visItemTop=top;
if (position == mSrcDragPos) {
visItemTop+=mItemHeightCollapsed + divHeight;
}
if (position <= mSrcDragPos && position > mExpDragPos) {
visItemPos=position + 1;
}
 else {
visItemPos=position;
}
break;
default :
visItemTop=top;
visItemPos=position;
}
int edge=getDragEdge(visItemPos,visItemTop);
if (floatViewMidY < edge) {
while (visItemPos >= 0) {
visItemPos--;
if (visItemPos <= 0) {
visItemPos=0;
break;
}
visItemTop-=getVisualItemHeight(visItemPos);
edge=getDragEdge(visItemPos,visItemTop);
if (floatViewMidY >= edge) {
break;
}
}
}
 else {
final int count=getCount();
while (visItemPos < count) {
if (visItemPos == count - 1) {
break;
}
visItemTop+=getVisualItemHeight(visItemPos);
edge=getDragEdge(visItemPos + 1,visItemTop);
if (floatViewMidY < edge) {
break;
}
visItemPos++;
}
}
final int numHeaders=getHeaderViewsCount();
final int numFooters=getFooterViewsCount();
if (visItemPos < numHeaders) {
return numHeaders;
}
 else if (visItemPos >= getCount() - numFooters) {
return getCount() - numFooters - 1;
}
return visItemPos;
}