Program: 18786
Project: 18786
Buggy source:
/** 
 * draws the given y values to the screen
 */
@Override protected void drawData(){
  ArrayList<LineDataSet> dataSets=mCurrentData.getDataSets();
  for (int i=0; i < mCurrentData.getDataSetCount(); i++) {
    LineDataSet dataSet=dataSets.get(i);
    ArrayList<Entry> entries=dataSet.getYVals();
    mRenderPaint.setStrokeWidth(dataSet.getLineWidth());
    mRenderPaint.setPathEffect(dataSet.getDashPathEffect());
    if (dataSet.isDrawCubicEnabled()) {
      mRenderPaint.setColor(dataSet.getColor());
      float intensity=dataSet.getCubicIntensity();
      Path spline=new Path();
      ArrayList<CPoint> points=new ArrayList<CPoint>();
      for (      Entry e : entries)       points.add(new CPoint(e.getXIndex(),e.getVal()));
      if (points.size() > 1) {
        for (int j=0; j < points.size() * mPhaseX; j++) {
          CPoint point=points.get(j);
          if (j == 0) {
            CPoint next=points.get(j + 1);
            point.dx=((next.x - point.x) * intensity);
            point.dy=((next.y - point.y) * intensity);
          }
 else           if (j == points.size() - 1) {
            CPoint prev=points.get(j - 1);
            point.dx=((point.x - prev.x) * intensity);
            point.dy=((point.y - prev.y) * intensity);
          }
 else {
            CPoint next=points.get(j + 1);
            CPoint prev=points.get(j - 1);
            point.dx=((next.x - prev.x) * intensity);
            point.dy=((next.y - prev.y) * intensity);
          }
          if (j == 0) {
            spline.moveTo(point.x,point.y * mPhaseY);
          }
 else {
            CPoint prev=points.get(j - 1);
            spline.cubicTo(prev.x + prev.dx,(prev.y + prev.dy) * mPhaseY,point.x - point.dx,(point.y - point.dy) * mPhaseY,point.x,point.y * mPhaseY);
          }
        }
      }
      if (dataSet.isDrawFilledEnabled()) {
        float fillMin=dataSet.getYMin() >= 0 ? mYChartMin : 0;
        spline.lineTo((entries.size() - 1) * mPhaseX,fillMin);
        spline.lineTo(0,fillMin);
        spline.close();
        mRenderPaint.setStyle(Paint.Style.FILL);
      }
 else {
        mRenderPaint.setStyle(Paint.Style.STROKE);
      }
      transformPath(spline);
      mDrawCanvas.drawPath(spline,mRenderPaint);
    }
 else {
      mRenderPaint.setStyle(Paint.Style.STROKE);
      if (dataSet.getColors() == null || dataSet.getColors().size() > 1) {
        float[] valuePoints=generateTransformedValuesLineScatter(entries);
        for (int j=0; j < (valuePoints.length - 2) * mPhaseX; j+=2) {
          if (isOffContentRight(valuePoints[j]))           break;
          if (j != 0 && isOffContentLeft(valuePoints[j - 1]) && isOffContentTop(valuePoints[j + 1]) && isOffContentBottom(valuePoints[j + 1]))           continue;
          mRenderPaint.setColor(dataSet.getColor(j / 2));
          mDrawCanvas.drawLine(valuePoints[j],valuePoints[j + 1],valuePoints[j + 2],valuePoints[j + 3],mRenderPaint);
        }
      }
 else {
        mRenderPaint.setColor(dataSet.getColor());
        float[] valuePoints=generateTransformedValuesLineScatter(entries);
        for (int j=0; j < (valuePoints.length - 2) * mPhaseX; j+=2) {
          if (isOffContentRight(valuePoints[j]))           break;
          if (j != 0 && isOffContentLeft(valuePoints[j - 1]) && isOffContentTop(valuePoints[j + 1]) && isOffContentBottom(valuePoints[j + 1]))           continue;
          mDrawCanvas.drawLine(valuePoints[j],valuePoints[j + 1],valuePoints[j + 2],valuePoints[j + 3],mRenderPaint);
        }
      }
      mRenderPaint.setPathEffect(null);
      if (dataSet.isDrawFilledEnabled() && entries.size() > 0) {
        mRenderPaint.setStyle(Paint.Style.FILL);
        mRenderPaint.setColor(dataSet.getFillColor());
        mRenderPaint.setAlpha(dataSet.getFillAlpha());
        float fillMin=dataSet.getYMin() >= 0 ? mYChartMin : 0;
        Path filled=generateFilledPath(entries,fillMin);
        transformPath(filled);
        mDrawCanvas.drawPath(filled,mRenderPaint);
        mRenderPaint.setAlpha(255);
      }
    }
    mRenderPaint.setPathEffect(null);
  }
}

Fixed version (ground truth):
/** 
 * draws the given y values to the screen
 */
@Override protected void drawData(){
  ArrayList<LineDataSet> dataSets=mCurrentData.getDataSets();
  for (int i=0; i < mCurrentData.getDataSetCount(); i++) {
    LineDataSet dataSet=dataSets.get(i);
    ArrayList<Entry> entries=dataSet.getYVals();
    mRenderPaint.setStrokeWidth(dataSet.getLineWidth());
    mRenderPaint.setPathEffect(dataSet.getDashPathEffect());
    if (dataSet.isDrawCubicEnabled()) {
      mRenderPaint.setColor(dataSet.getColor());
      float intensity=dataSet.getCubicIntensity();
      Path spline=new Path();
      ArrayList<CPoint> points=new ArrayList<CPoint>();
      for (      Entry e : entries)       points.add(new CPoint(e.getXIndex(),e.getVal()));
      if (points.size() > 1) {
        for (int j=0; j < points.size() * mPhaseX; j++) {
          CPoint point=points.get(j);
          if (j == 0) {
            CPoint next=points.get(j + 1);
            point.dx=((next.x - point.x) * intensity);
            point.dy=((next.y - point.y) * intensity);
          }
 else           if (j == points.size() - 1) {
            CPoint prev=points.get(j - 1);
            point.dx=((point.x - prev.x) * intensity);
            point.dy=((point.y - prev.y) * intensity);
          }
 else {
            CPoint next=points.get(j + 1);
            CPoint prev=points.get(j - 1);
            point.dx=((next.x - prev.x) * intensity);
            point.dy=((next.y - prev.y) * intensity);
          }
          if (j == 0) {
            spline.moveTo(point.x,point.y * mPhaseY);
          }
 else {
            CPoint prev=points.get(j - 1);
            spline.cubicTo(prev.x + prev.dx,(prev.y + prev.dy) * mPhaseY,point.x - point.dx,(point.y - point.dy) * mPhaseY,point.x,point.y * mPhaseY);
          }
        }
      }
      if (dataSet.isDrawFilledEnabled()) {
        float fillMin=dataSet.getYMin() >= 0 ? mYChartMin : 0;
        spline.lineTo((entries.size() - 1) * mPhaseX,fillMin);
        spline.lineTo(0,fillMin);
        spline.close();
        mRenderPaint.setStyle(Paint.Style.FILL);
      }
 else {
        mRenderPaint.setStyle(Paint.Style.STROKE);
      }
      transformPath(spline);
      mDrawCanvas.drawPath(spline,mRenderPaint);
    }
 else {
      mRenderPaint.setStyle(Paint.Style.STROKE);
      if (dataSet.getColors() == null || dataSet.getColors().size() > 1) {
        float[] valuePoints=generateTransformedValuesLineScatter(entries);
        for (int j=0; j < (valuePoints.length - 2) * mPhaseX; j+=2) {
          if (isOffContentRight(valuePoints[j]))           break;
          if (j != 0 && isOffContentLeft(valuePoints[j - 1]) && isOffContentTop(valuePoints[j + 1]) && isOffContentBottom(valuePoints[j + 1]))           continue;
          mRenderPaint.setColor(dataSet.getColor(j / 2));
          mDrawCanvas.drawLine(valuePoints[j],valuePoints[j + 1],valuePoints[j + 2],valuePoints[j + 3],mRenderPaint);
        }
      }
 else {
        mRenderPaint.setColor(dataSet.getColor());
        Path line=generateLinePath(entries);
        transformPath(line);
        mDrawCanvas.drawPath(line,mRenderPaint);
      }
      mRenderPaint.setPathEffect(null);
      if (dataSet.isDrawFilledEnabled() && entries.size() > 0) {
        mRenderPaint.setStyle(Paint.Style.FILL);
        mRenderPaint.setColor(dataSet.getFillColor());
        mRenderPaint.setAlpha(dataSet.getFillAlpha());
        float fillMin=dataSet.getYMin() >= 0 ? mYChartMin : 0;
        Path filled=generateFilledPath(entries,fillMin);
        transformPath(filled);
        mDrawCanvas.drawPath(filled,mRenderPaint);
        mRenderPaint.setAlpha(255);
      }
    }
    mRenderPaint.setPathEffect(null);
  }
}