Program: 18236
Project: 18236
Buggy source:
/** 
 * Performs the all operations necessary for pinch and axis zoom.
 * @param event
 */
private void performZoom(MotionEvent event){
  if (event.getPointerCount() >= 2) {
    OnChartGestureListener l=mChart.getOnChartGestureListener();
    float totalDist=spacing(event);
    if (totalDist > 10f) {
      PointF t=getTrans(mTouchPointCenter.x,mTouchPointCenter.y);
      if (mTouchMode == PINCH_ZOOM) {
        mLastGesture=ChartGesture.PINCH_ZOOM;
        float scale=totalDist / mSavedDist;
        boolean isZoomingOut=(scale < 1);
        boolean canZoomMoreX=isZoomingOut ? mChart.getViewPortHandler().canZoomOutMoreX() : mChart.getViewPortHandler().canZoomInMoreX();
        float scaleX=(mChart.isScaleXEnabled()) ? scale : 1f;
        float scaleY=(mChart.isScaleYEnabled()) ? scale : 1f;
        if (mChart.isScaleYEnabled() || canZoomMoreX) {
          mMatrix.set(mSavedMatrix);
          mMatrix.postScale(scaleX,scaleY,t.x,t.y);
          if (l != null)           l.onChartScale(event,scaleX,scaleY);
        }
      }
 else       if (mTouchMode == X_ZOOM && mChart.isScaleXEnabled()) {
        mLastGesture=ChartGesture.X_ZOOM;
        float xDist=getXDist(event);
        float scaleX=xDist / mSavedXDist;
        boolean isZoomingOut=(scaleX < 1);
        boolean canZoomMoreX=isZoomingOut ? mChart.getViewPortHandler().canZoomOutMoreX() : mChart.getViewPortHandler().canZoomInMoreX();
        if (canZoomMoreX) {
          mMatrix.set(mSavedMatrix);
          mMatrix.postScale(scaleX,1f,t.x,t.y);
          if (l != null)           l.onChartScale(event,scaleX,1f);
        }
      }
 else       if (mTouchMode == Y_ZOOM && mChart.isScaleYEnabled()) {
        mLastGesture=ChartGesture.Y_ZOOM;
        float yDist=getYDist(event);
        float scaleY=yDist / mSavedYDist;
        mMatrix.set(mSavedMatrix);
        mMatrix.postScale(1f,scaleY,t.x,t.y);
        if (l != null)         l.onChartScale(event,1f,scaleY);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Performs the all operations necessary for pinch and axis zoom.
 * @param event
 */
private void performZoom(MotionEvent event){
  if (event.getPointerCount() >= 2) {
    OnChartGestureListener l=mChart.getOnChartGestureListener();
    float totalDist=spacing(event);
    if (totalDist > mMinScalePointerDistance) {
      PointF t=getTrans(mTouchPointCenter.x,mTouchPointCenter.y);
      ViewPortHandler h=mChart.getViewPortHandler();
      if (mTouchMode == PINCH_ZOOM) {
        mLastGesture=ChartGesture.PINCH_ZOOM;
        float scale=totalDist / mSavedDist;
        boolean isZoomingOut=(scale < 1);
        boolean canZoomMoreX=isZoomingOut ? h.canZoomOutMoreX() : h.canZoomInMoreX();
        boolean canZoomMoreY=isZoomingOut ? h.canZoomOutMoreY() : h.canZoomInMoreY();
        float scaleX=(mChart.isScaleXEnabled()) ? scale : 1f;
        float scaleY=(mChart.isScaleYEnabled()) ? scale : 1f;
        if (canZoomMoreY || canZoomMoreX) {
          mMatrix.set(mSavedMatrix);
          mMatrix.postScale(scaleX,scaleY,t.x,t.y);
          if (l != null)           l.onChartScale(event,scaleX,scaleY);
        }
      }
 else       if (mTouchMode == X_ZOOM && mChart.isScaleXEnabled()) {
        mLastGesture=ChartGesture.X_ZOOM;
        float xDist=getXDist(event);
        float scaleX=xDist / mSavedXDist;
        boolean isZoomingOut=(scaleX < 1);
        boolean canZoomMoreX=isZoomingOut ? h.canZoomOutMoreX() : h.canZoomInMoreX();
        if (canZoomMoreX) {
          mMatrix.set(mSavedMatrix);
          mMatrix.postScale(scaleX,1f,t.x,t.y);
          if (l != null)           l.onChartScale(event,scaleX,1f);
        }
      }
 else       if (mTouchMode == Y_ZOOM && mChart.isScaleYEnabled()) {
        mLastGesture=ChartGesture.Y_ZOOM;
        float yDist=getYDist(event);
        float scaleY=yDist / mSavedYDist;
        boolean isZoomingOut=(scaleY < 1);
        boolean canZoomMoreY=isZoomingOut ? h.canZoomOutMoreY() : h.canZoomInMoreY();
        if (canZoomMoreY) {
          mMatrix.set(mSavedMatrix);
          mMatrix.postScale(1f,scaleY,t.x,t.y);
          if (l != null)           l.onChartScale(event,1f,scaleY);
        }
      }
    }
  }
}