Program: 18590
Project: 18590
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() - 3; j+=2) {
      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 / 2));
      c.drawLine(buffer.buffer[j],buffer.buffer[j + 1],buffer.buffer[j + 2],buffer.buffer[j + 3],mRenderPaint);
    }
  }
 else {
    int from=mMinX * 4;
    int range=(mMaxX * 4 - mMinX) + 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):
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);
  }
}