Program: 88823
Project: 88823
Buggy source:
private void calculatePageLimitAndMargin(){
  int contentSize, viewSize;
  if (mConfig.orientation == CarouselConfig.HORIZONTAL) {
    contentSize=mResources.getDimensionPixelSize(R.dimen.page_content_width);
    viewSize=mViewPagerWidth;
  }
 else {
    contentSize=mResources.getDimensionPixelSize(R.dimen.page_content_height);
    viewSize=mViewPagerHeight;
  }
  int minOffset=0;
switch (mConfig.scrollScalingMode) {
case CarouselConfig.SCROLL_MODE_BIG_CURRENT:
{
      minOffset=(int)(mConfig.getDiffScale() * contentSize / 2) + mMinPagesOffset;
      contentSize*=mConfig.smallScale;
      break;
    }
case CarouselConfig.SCROLL_MODE_BIG_ALL:
{
    minOffset=(int)(mConfig.getDiffScale() * contentSize) + mMinPagesOffset;
    contentSize*=mConfig.smallScale;
    break;
  }
case CarouselConfig.SCROLL_MODE_NONE:
{
  minOffset=mMinPagesOffset;
  break;
}
}
if (contentSize + 2 * minOffset > viewSize) {
Log.w(TAG,"String_Node_Str");
return;
}
final float step=0.1f;
while (contentSize + 2 * contentSize * (mSidePagesVisiblePart - step) + 2 * minOffset > viewSize && Math.abs(mSidePagesVisiblePart - step) > 1e-6) {
mSidePagesVisiblePart-=step;
}
int fullPages=0;
final int s=viewSize - (int)(2 * contentSize * mSidePagesVisiblePart);
while (minOffset + (fullPages + 1) * (contentSize + minOffset) <= s) {
fullPages++;
}
if (fullPages != 0 && fullPages % 2 == 0) {
fullPages--;
}
int offset=(s - fullPages * contentSize) / (fullPages + 1);
if (Math.abs(mSidePagesVisiblePart) > 1e-6) {
mPageLimit=(fullPages + 2) - 1;
}
 else {
mPageLimit=fullPages - 1;
}
mPageLimit*=3;
mConfig.pageLimit=mPageLimit;
if (mConfig.orientation == CarouselConfig.VERTICAL) {
mPageMargin=-(int)((viewSize - contentSize - offset) * mConfig.scaleY);
}
 else {
mPageMargin=-(viewSize - contentSize - offset);
}
mConfig.pageMargin=mPageMargin;
}

Fixed version (ground truth):
private void calculatePageLimitAndMargin(){
  int contentSize, viewSize;
  if (mConfig.orientation == CarouselConfig.HORIZONTAL) {
    contentSize=mResources.getDimensionPixelSize(R.dimen.page_content_width);
    viewSize=mViewPagerWidth;
  }
 else {
    contentSize=mResources.getDimensionPixelSize(R.dimen.page_content_height);
    viewSize=mViewPagerHeight;
  }
  int minOffset=0;
switch (mConfig.scrollScalingMode) {
case CarouselConfig.SCROLL_MODE_BIG_CURRENT:
{
      minOffset=(int)(mConfig.getDiffScale() * contentSize / 2) + mMinPagesOffset;
      contentSize*=mConfig.smallScale;
      break;
    }
case CarouselConfig.SCROLL_MODE_BIG_ALL:
{
    minOffset=(int)(mConfig.getDiffScale() * contentSize) + mMinPagesOffset;
    contentSize*=mConfig.smallScale;
    break;
  }
case CarouselConfig.SCROLL_MODE_NONE:
{
  minOffset=mMinPagesOffset;
  break;
}
}
if (contentSize + 2 * minOffset > viewSize) {
Log.w(TAG,"String_Node_Str");
return;
}
final float step=0.1f;
while (contentSize + 2 * contentSize * (mSidePagesVisiblePart - step) + 2 * minOffset > viewSize && Math.abs(mSidePagesVisiblePart - step) > 1e-6) {
mSidePagesVisiblePart-=step;
}
int fullPages=0;
final int s=viewSize - (int)(2 * contentSize * mSidePagesVisiblePart);
while (minOffset + (fullPages + 1) * (contentSize + minOffset) <= s) {
fullPages++;
}
if (fullPages != 0 && fullPages % 2 == 0) {
fullPages--;
}
int offset=(s - fullPages * contentSize) / (fullPages + 1);
if (Math.abs(mSidePagesVisiblePart) > 1e-6) {
mPageLimit=(fullPages + 2) - 1;
}
 else {
mPageLimit=fullPages - 1;
}
mPageLimit=2 * mPageLimit + mPageLimit / 2;
mConfig.pageLimit=mPageLimit;
if (mConfig.orientation == CarouselConfig.VERTICAL) {
mPageMargin=-(int)((viewSize - contentSize - offset) * mConfig.scaleY);
}
 else {
mPageMargin=-(viewSize - contentSize - offset);
}
mConfig.pageMargin=mPageMargin;
}