Program: 88804
Project: 88804
Buggy source:
private void calculatePageLimitAndMargin() throws CarouselConfigException {
  if (sConfig.orientation != CarouselConfig.HORIZONTAL && sConfig.orientation != CarouselConfig.VERTICAL) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int contentSize, viewSize;
  if (sConfig.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=(int)(CarouselConfig.DIFF_SCALE * contentSize / 2) + mMinOffset;
  contentSize*=CarouselConfig.SMALL_SCALE;
  if (contentSize + 2 * minOffset > viewSize) {
    throw new CarouselConfigException("String_Node_Str");
  }
  final float step=0.1f;
  while (contentSize + 2 * contentSize * (mVisiblePart - step) + 2 * minOffset > viewSize && Math.abs(mVisiblePart - step) > 1e-6) {
    mVisiblePart-=step;
  }
  int fullPages=0;
  final int s=viewSize - (int)(2 * contentSize * mVisiblePart);
  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(mVisiblePart) > 1e-6) {
    mPageLimit=(fullPages + 2) - 1;
  }
 else {
    mPageLimit=fullPages - 1;
  }
  sConfig.visiblePages=mPageLimit + 1;
  if (sConfig.orientation == CarouselConfig.VERTICAL) {
    mPageMargin=-(int)((viewSize - contentSize - offset) * sConfig.scaleY);
  }
 else {
    mPageMargin=-(viewSize - contentSize - offset);
  }
}

Fixed version (ground truth):
private void calculatePageLimitAndMargin() throws CarouselConfigException {
  if (mConfig.orientation != CarouselConfig.HORIZONTAL && mConfig.orientation != CarouselConfig.VERTICAL) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  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=(int)(CarouselConfig.DIFF_SCALE * contentSize / 2) + mMinOffset;
  contentSize*=CarouselConfig.SMALL_SCALE;
  if (contentSize + 2 * minOffset > viewSize) {
    throw new CarouselConfigException("String_Node_Str");
  }
  final float step=0.1f;
  while (contentSize + 2 * contentSize * (mVisiblePart - step) + 2 * minOffset > viewSize && Math.abs(mVisiblePart - step) > 1e-6) {
    mVisiblePart-=step;
  }
  int fullPages=0;
  final int s=viewSize - (int)(2 * contentSize * mVisiblePart);
  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(mVisiblePart) > 1e-6) {
    mPageLimit=(fullPages + 2) - 1;
  }
 else {
    mPageLimit=fullPages - 1;
  }
  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;
}