Program: 26303
Project: 26303
Buggy source:
@Override public void drawValues(Canvas c){
  if (passesCheck()) {
    List<IBarDataSet> dataSets=mChart.getBarData().getDataSets();
    final float valueOffsetPlus=Utils.convertDpToPixel(4.5f);
    float posOffset=0f;
    float negOffset=0f;
    boolean drawValueAboveBar=mChart.isDrawValueAboveBarEnabled();
    for (int i=0; i < mChart.getBarData().getDataSetCount(); i++) {
      IBarDataSet dataSet=dataSets.get(i);
      if (!dataSet.isDrawValuesEnabled() || dataSet.getEntryCount() == 0)       continue;
      applyValueTextStyle(dataSet);
      boolean isInverted=mChart.isInverted(dataSet.getAxisDependency());
      float valueTextHeight=Utils.calcTextHeight(mValuePaint,"String_Node_Str");
      posOffset=(drawValueAboveBar ? -valueOffsetPlus : valueTextHeight + valueOffsetPlus);
      negOffset=(drawValueAboveBar ? valueTextHeight + valueOffsetPlus : -valueOffsetPlus);
      if (isInverted) {
        posOffset=-posOffset - valueTextHeight;
        negOffset=-negOffset - valueTextHeight;
      }
      BarBuffer buffer=mBarBuffers[i];
      if (!dataSet.isStacked()) {
        for (int j=0; j < buffer.buffer.length * mAnimator.getPhaseX(); j+=4) {
          float x=(buffer.buffer[j] + buffer.buffer[j + 2]) / 2f;
          if (!mViewPortHandler.isInBoundsRight(x))           break;
          if (!mViewPortHandler.isInBoundsY(buffer.buffer[j + 1]) || !mViewPortHandler.isInBoundsLeft(x))           continue;
          BarEntry entry=dataSet.getEntryForIndex(j / 4);
          float val=entry.getY();
          drawValue(c,dataSet.getValueFormatter(),val,entry,i,x,buffer.buffer[j + 1] + (val >= 0 ? posOffset : negOffset),dataSet.getValueTextColor(j / 4));
        }
      }
 else {
        Transformer trans=mChart.getTransformer(dataSet.getAxisDependency());
        int bufferIndex=0;
        int index=0;
        while (index < dataSet.getEntryCount() * mAnimator.getPhaseX()) {
          BarEntry entry=dataSet.getEntryForIndex(index);
          float[] vals=entry.getYVals();
          float x=(buffer.buffer[bufferIndex] + buffer.buffer[bufferIndex + 2]) / 2f;
          int color=dataSet.getValueTextColor(index);
          if (vals == null) {
            if (!mViewPortHandler.isInBoundsRight(x))             break;
            if (!mViewPortHandler.isInBoundsY(buffer.buffer[bufferIndex + 1]) || !mViewPortHandler.isInBoundsLeft(x))             continue;
            drawValue(c,dataSet.getValueFormatter(),entry.getY(),entry,i,x,buffer.buffer[bufferIndex + 1] + (entry.getY() >= 0 ? posOffset : negOffset),color);
          }
 else {
            float[] transformed=new float[vals.length * 2];
            float posY=0f;
            float negY=-entry.getNegativeSum();
            for (int k=0, idx=0; k < transformed.length; k+=2, idx++) {
              float value=vals[idx];
              float y;
              if (value >= 0f) {
                posY+=value;
                y=posY;
              }
 else {
                y=negY;
                negY-=value;
              }
              transformed[k + 1]=y * mAnimator.getPhaseY();
            }
            trans.pointValuesToPixel(transformed);
            for (int k=0; k < transformed.length; k+=2) {
              float y=transformed[k + 1] + (vals[k / 2] >= 0 ? posOffset : negOffset);
              if (!mViewPortHandler.isInBoundsRight(x))               break;
              if (!mViewPortHandler.isInBoundsY(y) || !mViewPortHandler.isInBoundsLeft(x))               continue;
              drawValue(c,dataSet.getValueFormatter(),vals[k / 2],entry,i,x,y,color);
            }
          }
          bufferIndex=vals == null ? bufferIndex + 4 : bufferIndex + 4 * vals.length;
          index++;
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void drawValues(Canvas c){
  if (passesCheck()) {
    List<IBarDataSet> dataSets=mChart.getBarData().getDataSets();
    final float valueOffsetPlus=Utils.convertDpToPixel(4.5f);
    float posOffset=0f;
    float negOffset=0f;
    boolean drawValueAboveBar=mChart.isDrawValueAboveBarEnabled();
    for (int i=0; i < mChart.getBarData().getDataSetCount(); i++) {
      IBarDataSet dataSet=dataSets.get(i);
      if (!dataSet.isDrawValuesEnabled() || dataSet.getEntryCount() == 0)       continue;
      applyValueTextStyle(dataSet);
      boolean isInverted=mChart.isInverted(dataSet.getAxisDependency());
      float valueTextHeight=Utils.calcTextHeight(mValuePaint,"String_Node_Str");
      posOffset=(drawValueAboveBar ? -valueOffsetPlus : valueTextHeight + valueOffsetPlus);
      negOffset=(drawValueAboveBar ? valueTextHeight + valueOffsetPlus : -valueOffsetPlus);
      if (isInverted) {
        posOffset=-posOffset - valueTextHeight;
        negOffset=-negOffset - valueTextHeight;
      }
      BarBuffer buffer=mBarBuffers[i];
      if (!dataSet.isStacked()) {
        for (int j=0; j < buffer.buffer.length * mAnimator.getPhaseX(); j+=4) {
          float x=(buffer.buffer[j] + buffer.buffer[j + 2]) / 2f;
          if (!mViewPortHandler.isInBoundsRight(x))           break;
          if (!mViewPortHandler.isInBoundsY(buffer.buffer[j + 1]) || !mViewPortHandler.isInBoundsLeft(x))           continue;
          BarEntry entry=dataSet.getEntryForIndex(j / 4);
          float val=entry.getY();
          drawValue(c,dataSet.getValueFormatter(),val,entry,i,x,val >= 0 ? (buffer.buffer[j + 1] + posOffset) : (buffer.buffer[j + 3] + negOffset),dataSet.getValueTextColor(j / 4));
        }
      }
 else {
        Transformer trans=mChart.getTransformer(dataSet.getAxisDependency());
        int bufferIndex=0;
        int index=0;
        while (index < dataSet.getEntryCount() * mAnimator.getPhaseX()) {
          BarEntry entry=dataSet.getEntryForIndex(index);
          float[] vals=entry.getYVals();
          float x=(buffer.buffer[bufferIndex] + buffer.buffer[bufferIndex + 2]) / 2f;
          int color=dataSet.getValueTextColor(index);
          if (vals == null) {
            if (!mViewPortHandler.isInBoundsRight(x))             break;
            if (!mViewPortHandler.isInBoundsY(buffer.buffer[bufferIndex + 1]) || !mViewPortHandler.isInBoundsLeft(x))             continue;
            drawValue(c,dataSet.getValueFormatter(),entry.getY(),entry,i,x,buffer.buffer[bufferIndex + 1] + (entry.getY() >= 0 ? posOffset : negOffset),color);
          }
 else {
            float[] transformed=new float[vals.length * 2];
            float posY=0f;
            float negY=-entry.getNegativeSum();
            for (int k=0, idx=0; k < transformed.length; k+=2, idx++) {
              float value=vals[idx];
              float y;
              if (value >= 0f) {
                posY+=value;
                y=posY;
              }
 else {
                y=negY;
                negY-=value;
              }
              transformed[k + 1]=y * mAnimator.getPhaseY();
            }
            trans.pointValuesToPixel(transformed);
            for (int k=0; k < transformed.length; k+=2) {
              float y=transformed[k + 1] + (vals[k / 2] >= 0 ? posOffset : negOffset);
              if (!mViewPortHandler.isInBoundsRight(x))               break;
              if (!mViewPortHandler.isInBoundsY(y) || !mViewPortHandler.isInBoundsLeft(x))               continue;
              drawValue(c,dataSet.getValueFormatter(),vals[k / 2],entry,i,x,y,color);
            }
          }
          bufferIndex=vals == null ? bufferIndex + 4 : bufferIndex + 4 * vals.length;
          index++;
        }
      }
    }
  }
}