Program: 26659
Project: 26659
Buggy source:
protected void drawLinear(Canvas c,LineDataSet dataSet,ArrayList<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);
  LineBuffer buffer=mLineBuffers[dataSetIndex];
  buffer.setPhases(phaseX,phaseY);
  buffer.feed(entries);
  trans.pointValuesToPixel(buffer.buffer);
  if (dataSet.getColors().size() > 1) {
    for (int j=0; j < buffer.size(); 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));
      c.drawLine(buffer.buffer[j],buffer.buffer[j + 1],buffer.buffer[j + 2],buffer.buffer[j + 3],mRenderPaint);
    }
  }
 else {
    Entry entryFrom=dataSet.getEntryForXIndex(mMinX);
    Entry entryTo=dataSet.getEntryForXIndex(mMaxX);
    int minx=dataSet.getEntryPosition(entryFrom);
    int maxx=dataSet.getEntryPosition(entryTo);
    int from=minx * 4;
    int range=(maxx * 4 - from) + 4;
    int to=range + from;
    mRenderPaint.setColor(dataSet.getColor());
    c.drawLines(buffer.buffer,from,to >= buffer.size() ? buffer.size() - from : range,mRenderPaint);
  }
  mRenderPaint.setPathEffect(null);
  if (dataSet.isDrawFilledEnabled() && entries.size() > 0) {
    drawLinearFill(c,dataSet,entries,trans);
  }
}

Fixed version (ground truth):
/** 
 * Draws a normal line.
 * @param c
 * @param dataSet
 * @param entries
 */
protected void drawLinear(Canvas c,LineDataSet dataSet,ArrayList<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;
  }
  LineBuffer buffer=mLineBuffers[dataSetIndex];
  buffer.setPhases(phaseX,phaseY);
  buffer.feed(entries);
  trans.pointValuesToPixel(buffer.buffer);
  if (dataSet.getColors().size() > 1) {
    for (int j=0; j < buffer.size(); 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));
      canvas.drawLine(buffer.buffer[j],buffer.buffer[j + 1],buffer.buffer[j + 2],buffer.buffer[j + 3],mRenderPaint);
    }
  }
 else {
    Entry entryFrom=dataSet.getEntryForXIndex(mMinX);
    Entry entryTo=dataSet.getEntryForXIndex(mMaxX);
    int minx=dataSet.getEntryPosition(entryFrom);
    int maxx=dataSet.getEntryPosition(entryTo);
    int from=minx * 4;
    int range=(maxx * 4 - from) + 4;
    int to=range + from;
    mRenderPaint.setColor(dataSet.getColor());
    canvas.drawLines(buffer.buffer,from,to >= buffer.size() ? buffer.size() - from : range,mRenderPaint);
  }
  mRenderPaint.setPathEffect(null);
  if (dataSet.isDrawFilledEnabled() && entries.size() > 0) {
    drawLinearFill(c,dataSet,entries,trans);
  }
}