Program: 88817
Project: 88817
Buggy source:
private boolean calculatePageLimitAndMargin(Context context){
  if (mViewPagerWidth == 0 || mViewPagerHeight == 0) {
    return false;
  }
  int contentSize, viewSize;
  if (mConfig.orientation == CarouselConfig.HORIZONTAL) {
    contentSize=getPageContentWidth(context.getPackageName(),mResources);
    viewSize=mViewPagerWidth;
  }
 else {
    contentSize=getPageContentHeight(context.getPackageName(),mResources);
    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) {
if (DEBUG) {
Log.d(TAG,"String_Node_Str");
}
return false;
}
while (true) {
if (mSidePagesVisiblePart < 0.0f) {
mSidePagesVisiblePart=0.0f;
break;
}
if (contentSize + 2 * contentSize * (mSidePagesVisiblePart) + 2 * minOffset <= viewSize) {
break;
}
mSidePagesVisiblePart-=0.1f;
}
int fullPages=1;
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);
int pageLimit;
if (Math.abs(mSidePagesVisiblePart) > 1e-6) {
pageLimit=(fullPages + 2) - 1;
}
 else {
pageLimit=fullPages - 1;
}
pageLimit=2 * pageLimit + pageLimit / 2;
mConfig.pageLimit=pageLimit;
mConfig.pageMargin=-(viewSize - contentSize - offset);
return true;
}

Fixed version (ground truth):
/** 
 * @param context Context.
 * @return True, if config was successfully updated.
 */
private boolean calculatePageLimitAndMargin(Context context){
  if (mViewPagerWidth == 0 || mViewPagerHeight == 0) {
    return false;
  }
  int contentSize, viewSize;
  if (mConfig.orientation == CarouselConfig.HORIZONTAL) {
    contentSize=getPageContentWidth(context.getPackageName(),mResources);
    viewSize=mViewPagerWidth;
  }
 else {
    contentSize=getPageContentHeight(context.getPackageName(),mResources);
    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) {
if (DEBUG) {
Log.d(TAG,"String_Node_Str");
}
return false;
}
while (true) {
if (mSidePagesVisiblePart < 0.0f) {
mSidePagesVisiblePart=0.0f;
break;
}
if (contentSize + 2 * contentSize * (mSidePagesVisiblePart) + 2 * minOffset <= viewSize) {
break;
}
mSidePagesVisiblePart-=0.1f;
}
int fullPages=1;
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);
int pageLimit;
if (Math.abs(mSidePagesVisiblePart) > 1e-6) {
pageLimit=(fullPages + 2) - 1;
}
 else {
pageLimit=fullPages - 1;
}
pageLimit=2 * pageLimit + pageLimit / 2;
mConfig.pageLimit=pageLimit;
mConfig.pageMargin=-(viewSize - contentSize - offset);
return true;
}