Program: 18859
Project: 18859
Buggy source:
/** 
 * draws the given y values to the screen
 */
@Override protected void drawData(){
  ArrayList<LineDataSet> dataSets=(ArrayList<LineDataSet>)mCurrentData.getDataSets();
  for (int i=0; i < mCurrentData.getDataSetCount(); i++) {
    LineDataSet dataSet=dataSets.get(i);
    ArrayList<? extends Entry> entries=dataSet.getYVals();
    mRenderPaint.setStrokeWidth(dataSet.getLineWidth());
    mRenderPaint.setPathEffect(dataSet.getDashPathEffect());
    if (dataSet.isDrawCubicEnabled()) {
      mRenderPaint.setColor(dataSet.getColor(i));
      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()) {
        spline.lineTo((entries.size() - 1) * mPhaseX,mYChartMin);
        spline.lineTo(0,mYChartMin);
        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);
      float[] valuePoints=generateTransformedValues(entries,0f);
      for (int j=0; j < (valuePoints.length - 2) * mPhaseX; j+=2) {
        mRenderPaint.setColor(dataSet.getColor(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());
        Path filled=generateFilledPath(entries);
        transformPath(filled);
        mDrawCanvas.drawPath(filled,mRenderPaint);
        mRenderPaint.setAlpha(255);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * draws the given y values to the screen
 */
@Override protected void drawData(){
  ArrayList<LineDataSet> dataSets=(ArrayList<LineDataSet>)mCurrentData.getDataSets();
  for (int i=0; i < mCurrentData.getDataSetCount(); i++) {
    LineDataSet dataSet=dataSets.get(i);
    ArrayList<? extends Entry> entries=dataSet.getYVals();
    mRenderPaint.setStrokeWidth(dataSet.getLineWidth());
    mRenderPaint.setPathEffect(dataSet.getDashPathEffect());
    if (dataSet.isDrawCubicEnabled()) {
      mRenderPaint.setColor(dataSet.getColor(i));
      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);
      float[] valuePoints=generateTransformedValues(entries,0f);
      for (int j=0; j < (valuePoints.length - 2) * mPhaseX; j+=2) {
        mRenderPaint.setColor(dataSet.getColor(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);
      }
    }
  }
}