Program: 18436
Project: 18436
Buggy source:
/** 
 * Draws a normal line.
 * @param c
 * @param dataSet
 * @param entries
 */
protected void drawLinear(Canvas c,LineDataSet dataSet,List<Entry> entries){
  int dataSetIndex=mChart.getLineData().getIndexOfDataSet(dataSet);
  Transformer trans=mChart.getTransformer(dataSet.getAxisDependency());
  float phaseX=mAnimator.getPhaseX();
  float phaseY=mAnimator.getPhaseY();
  mRenderPaint.setStyle(Paint.Style.STROKE);
  Canvas canvas=null;
  if (dataSet.isDashedLineEnabled()) {
    canvas=mBitmapCanvas;
  }
 else {
    canvas=c;
  }
  Entry entryFrom=dataSet.getEntryForXIndex(mMinX);
  Entry entryTo=dataSet.getEntryForXIndex(mMaxX);
  int minx=dataSet.getEntryPosition(entryFrom);
  int maxx=Math.min(dataSet.getEntryPosition(entryTo) + 1,entries.size());
  int range=(maxx - minx) * 4 - 4;
  LineBuffer buffer=mLineBuffers[dataSetIndex];
  buffer.setPhases(phaseX,phaseY);
  buffer.limitFrom(minx);
  buffer.limitTo(maxx);
  buffer.feed(entries);
  trans.pointValuesToPixel(buffer.buffer);
  if (dataSet.getColors().size() > 1) {
    for (int j=0; j < range; j+=4) {
      if (!mViewPortHandler.isInBoundsRight(buffer.buffer[j]))       break;
      if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[j + 2]) || (!mViewPortHandler.isInBoundsTop(buffer.buffer[j + 1]) && !mViewPortHandler.isInBoundsBottom(buffer.buffer[j + 3])) || (!mViewPortHandler.isInBoundsTop(buffer.buffer[j + 1]) && !mViewPortHandler.isInBoundsBottom(buffer.buffer[j + 3])))       continue;
      mRenderPaint.setColor(dataSet.getColor(j / 4 + minx));
      canvas.drawLine(buffer.buffer[j],buffer.buffer[j + 1],buffer.buffer[j + 2],buffer.buffer[j + 3],mRenderPaint);
    }
  }
 else {
    mRenderPaint.setColor(dataSet.getColor());
    canvas.drawLines(buffer.buffer,0,range,mRenderPaint);
  }
  mRenderPaint.setPathEffect(null);
  if (dataSet.isDrawFilledEnabled() && entries.size() > 0) {
    drawLinearFill(c,dataSet,entries,minx,maxx,trans);
  }
}

Fixed version (ground truth):
/** 
 * Draws a normal line.
 * @param c
 * @param dataSet
 * @param entries
 */
protected void drawLinear(Canvas c,LineDataSet dataSet,List<Entry> entries){
  int dataSetIndex=mChart.getLineData().getIndexOfDataSet(dataSet);
  Transformer trans=mChart.getTransformer(dataSet.getAxisDependency());
  float phaseX=mAnimator.getPhaseX();
  float phaseY=mAnimator.getPhaseY();
  mRenderPaint.setStyle(Paint.Style.STROKE);
  Canvas canvas=null;
  if (dataSet.isDashedLineEnabled()) {
    canvas=mBitmapCanvas;
  }
 else {
    canvas=c;
  }
  Entry entryFrom=dataSet.getEntryForXIndex(mMinX);
  Entry entryTo=dataSet.getEntryForXIndex(mMaxX);
  int minx=Math.max(dataSet.getEntryPosition(entryFrom),0);
  int maxx=Math.min(dataSet.getEntryPosition(entryTo) + 1,entries.size());
  int range=(maxx - minx) * 4 - 4;
  LineBuffer buffer=mLineBuffers[dataSetIndex];
  buffer.setPhases(phaseX,phaseY);
  buffer.limitFrom(minx);
  buffer.limitTo(maxx);
  buffer.feed(entries);
  trans.pointValuesToPixel(buffer.buffer);
  if (dataSet.getColors().size() > 1) {
    for (int j=0; j < range; j+=4) {
      if (!mViewPortHandler.isInBoundsRight(buffer.buffer[j]))       break;
      if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[j + 2]) || (!mViewPortHandler.isInBoundsTop(buffer.buffer[j + 1]) && !mViewPortHandler.isInBoundsBottom(buffer.buffer[j + 3])) || (!mViewPortHandler.isInBoundsTop(buffer.buffer[j + 1]) && !mViewPortHandler.isInBoundsBottom(buffer.buffer[j + 3])))       continue;
      mRenderPaint.setColor(dataSet.getColor(j / 4 + minx));
      canvas.drawLine(buffer.buffer[j],buffer.buffer[j + 1],buffer.buffer[j + 2],buffer.buffer[j + 3],mRenderPaint);
    }
  }
 else {
    mRenderPaint.setColor(dataSet.getColor());
    canvas.drawLines(buffer.buffer,0,range,mRenderPaint);
  }
  mRenderPaint.setPathEffect(null);
  if (dataSet.isDrawFilledEnabled() && entries.size() > 0) {
    drawLinearFill(c,dataSet,entries,minx,maxx,trans);
  }
}