Program: 18616
Project: 18616
Buggy source:
@Override public void drawValues(Canvas c){
  if (passesCheck()) {
    ArrayList<BarDataSet> dataSets=mChart.getBarData().getDataSets();
    float posOffset=0f;
    float negOffset=0f;
    boolean drawValueAboveBar=mChart.isDrawValueAboveBarEnabled();
    posOffset=(drawValueAboveBar ? -Utils.convertDpToPixel(5) : Utils.calcTextHeight(mValuePaint,"String_Node_Str") * 1.5f);
    negOffset=(drawValueAboveBar ? Utils.calcTextHeight(mValuePaint,"String_Node_Str") * 1.5f : -Utils.convertDpToPixel(5));
    for (int i=0; i < mChart.getBarData().getDataSetCount(); i++) {
      BarDataSet dataSet=dataSets.get(i);
      if (!dataSet.isDrawValuesEnabled())       continue;
      applyValueTextStyle(dataSet);
      ValueFormatter formatter=dataSet.getValueFormatter();
      Transformer trans=mChart.getTransformer(dataSet.getAxisDependency());
      ArrayList<BarEntry> entries=dataSet.getYVals();
      float[] valuePoints=getTransformedValues(trans,entries,i);
      if (!mChart.isDrawValuesForWholeStackEnabled()) {
        for (int j=0; j < valuePoints.length * mAnimator.getPhaseX(); j+=2) {
          if (!mViewPortHandler.isInBoundsX(valuePoints[j]))           continue;
          if (!mViewPortHandler.isInBoundsTop(valuePoints[j + 1]))           break;
          if (!mViewPortHandler.isInBoundsBottom(valuePoints[j + 1]))           continue;
          float val=entries.get(j / 2).getVal();
          drawValue(c,val,valuePoints[j],valuePoints[j + 1] + (val >= 0 ? posOffset : negOffset),formatter);
        }
      }
 else {
        for (int j=0; j < (valuePoints.length - 1) * mAnimator.getPhaseX(); j+=2) {
          if (!mViewPortHandler.isInBoundsX(valuePoints[j]))           continue;
          if (!mViewPortHandler.isInBoundsTop(valuePoints[j + 1]))           break;
          if (!mViewPortHandler.isInBoundsBottom(valuePoints[j + 1]))           continue;
          BarEntry e=entries.get(j / 2);
          float[] vals=e.getVals();
          if (vals == null) {
            drawValue(c,e.getVal(),valuePoints[j],valuePoints[j + 1] + (e.getVal() >= 0 ? posOffset : negOffset),formatter);
          }
 else {
            float[] transformed=new float[vals.length * 2];
            int cnt=0;
            float add=e.getVal();
            for (int k=0; k < transformed.length; k+=2) {
              add-=vals[cnt];
              transformed[k]=(vals[cnt] + add) * mAnimator.getPhaseY();
              cnt++;
            }
            trans.pointValuesToPixel(transformed);
            for (int k=0; k < transformed.length; k+=2) {
              drawValue(c,vals[k / 2],transformed[k],valuePoints[j + 1] + (vals[k / 2] >= 0 ? posOffset : negOffset),formatter);
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void drawValues(Canvas c){
  if (passesCheck()) {
    ArrayList<BarDataSet> dataSets=mChart.getBarData().getDataSets();
    float posOffset=0f;
    float negOffset=0f;
    boolean drawValueAboveBar=mChart.isDrawValueAboveBarEnabled();
    negOffset=drawValueAboveBar ? -Utils.convertDpToPixel(5) : Utils.convertDpToPixel(5);
    posOffset=drawValueAboveBar ? Utils.convertDpToPixel(5) : -Utils.convertDpToPixel(5);
    if (drawValueAboveBar)     mValuePaint.setTextAlign(Align.LEFT);
 else     mValuePaint.setTextAlign(Align.RIGHT);
    for (int i=0; i < mChart.getBarData().getDataSetCount(); i++) {
      BarDataSet dataSet=dataSets.get(i);
      if (!dataSet.isDrawValuesEnabled())       continue;
      applyValueTextStyle(dataSet);
      mYOffset=Utils.calcTextHeight(mValuePaint,"String_Node_Str") / 2f;
      ValueFormatter formatter=dataSet.getValueFormatter();
      Transformer trans=mChart.getTransformer(dataSet.getAxisDependency());
      ArrayList<BarEntry> entries=dataSet.getYVals();
      float[] valuePoints=getTransformedValues(trans,entries,i);
      if (!mChart.isDrawValuesForWholeStackEnabled()) {
        for (int j=0; j < valuePoints.length * mAnimator.getPhaseX(); j+=2) {
          if (!mViewPortHandler.isInBoundsX(valuePoints[j]))           continue;
          if (!mViewPortHandler.isInBoundsTop(valuePoints[j + 1]))           break;
          if (!mViewPortHandler.isInBoundsBottom(valuePoints[j + 1]))           continue;
          float val=entries.get(j / 2).getVal();
          drawValue(c,val,valuePoints[j] + (val >= 0 ? posOffset : negOffset),valuePoints[j + 1],formatter);
        }
      }
 else {
        for (int j=0; j < (valuePoints.length - 1) * mAnimator.getPhaseX(); j+=2) {
          BarEntry e=entries.get(j / 2);
          float[] vals=e.getVals();
          if (vals == null) {
            if (!mViewPortHandler.isInBoundsX(valuePoints[j]))             continue;
            if (!mViewPortHandler.isInBoundsTop(valuePoints[j + 1]))             break;
            if (!mViewPortHandler.isInBoundsBottom(valuePoints[j + 1]))             continue;
            drawValue(c,e.getVal(),valuePoints[j] + (e.getVal() >= 0 ? posOffset : negOffset),valuePoints[j + 1],formatter);
          }
 else {
            float[] transformed=new float[vals.length * 2];
            int cnt=0;
            float add=e.getVal();
            for (int k=0; k < transformed.length; k+=2) {
              add-=vals[cnt];
              transformed[k]=(vals[cnt] + add) * mAnimator.getPhaseY();
              cnt++;
            }
            trans.pointValuesToPixel(transformed);
            for (int k=0; k < transformed.length; k+=2) {
              float x=transformed[k] + (vals[k / 2] >= 0 ? posOffset : negOffset);
              float y=valuePoints[j + 1];
              if (!mViewPortHandler.isInBoundsX(x))               continue;
              if (!mViewPortHandler.isInBoundsTop(y))               break;
              if (!mViewPortHandler.isInBoundsBottom(y))               continue;
              drawValue(c,vals[k / 2],x,y,formatter);
            }
          }
        }
      }
    }
  }
}