Program: 26377
Project: 26377
Buggy source:
@Override public void drawValues(Canvas c){
  PointF center=mChart.getCenterCircleBox();
  float r=mChart.getRadius();
  float rotationAngle=mChart.getRotationAngle();
  float[] drawAngles=mChart.getDrawAngles();
  float[] absoluteAngles=mChart.getAbsoluteAngles();
  float off=r / 10f * 3.6f;
  if (mChart.isDrawHoleEnabled()) {
    off=(r - (r / 100f * mChart.getHoleRadius())) / 2f;
  }
  r-=off;
  PieData data=mChart.getData();
  List<PieDataSet> dataSets=data.getDataSets();
  boolean drawXVals=mChart.isDrawSliceTextEnabled();
  int cnt=0;
  for (int i=0; i < dataSets.size(); i++) {
    PieDataSet dataSet=dataSets.get(i);
    if (!dataSet.isDrawValuesEnabled() && !drawXVals)     continue;
    applyValueTextStyle(dataSet);
    float lineHeight=Utils.calcTextHeight(mValuePaint,"String_Node_Str") + Utils.convertDpToPixel(4f);
    List<Entry> entries=dataSet.getYVals();
    for (int j=0, maxEntry=Math.min((int)Math.ceil(entries.size() * mAnimator.getPhaseX()),entries.size()); j < maxEntry; j++) {
      Entry entry=entries.get(j);
      float offset=drawAngles[cnt] / 2;
      float x=(float)(r * Math.cos(Math.toRadians((rotationAngle + absoluteAngles[cnt] - offset) * mAnimator.getPhaseY())) + center.x);
      float y=(float)(r * Math.sin(Math.toRadians((rotationAngle + absoluteAngles[cnt] - offset) * mAnimator.getPhaseY())) + center.y);
      float value=mChart.isUsePercentValuesEnabled() ? entry.getVal() / data.getYValueSum() * 100f : entry.getVal();
      ValueFormatter formatter=dataSet.getValueFormatter();
      boolean drawYVals=dataSet.isDrawValuesEnabled();
      if (drawXVals && drawYVals) {
        drawValue(c,formatter,value,entry,0,x,y);
        if (j < data.getXValCount())         c.drawText(data.getXVals().get(j),x,y + lineHeight,mValuePaint);
      }
 else       if (drawXVals && !drawYVals) {
        if (j < data.getXValCount())         c.drawText(data.getXVals().get(j),x,y + lineHeight / 2f,mValuePaint);
      }
 else       if (!drawXVals && drawYVals) {
        drawValue(c,formatter,value,entry,0,x,y + lineHeight / 2f);
      }
      cnt++;
    }
  }
}

Fixed version (ground truth):
@Override public void drawValues(Canvas c){
  PointF center=mChart.getCenterCircleBox();
  float r=mChart.getRadius();
  float rotationAngle=mChart.getRotationAngle();
  float[] drawAngles=mChart.getDrawAngles();
  float[] absoluteAngles=mChart.getAbsoluteAngles();
  float off=r / 10f * 3.6f;
  if (mChart.isDrawHoleEnabled()) {
    off=(r - (r / 100f * mChart.getHoleRadius())) / 2f;
  }
  r-=off;
  PieData data=mChart.getData();
  List<IPieDataSet> dataSets=data.getDataSets();
  boolean drawXVals=mChart.isDrawSliceTextEnabled();
  int cnt=0;
  for (int i=0; i < dataSets.size(); i++) {
    IPieDataSet dataSet=dataSets.get(i);
    if (!dataSet.isDrawValuesEnabled() && !drawXVals)     continue;
    applyValueTextStyle(dataSet);
    float lineHeight=Utils.calcTextHeight(mValuePaint,"String_Node_Str") + Utils.convertDpToPixel(4f);
    List<Entry> entries=dataSet.getYVals();
    for (int j=0, maxEntry=Math.min((int)Math.ceil(entries.size() * mAnimator.getPhaseX()),entries.size()); j < maxEntry; j++) {
      Entry entry=entries.get(j);
      float offset=drawAngles[cnt] / 2;
      float x=(float)(r * Math.cos(Math.toRadians((rotationAngle + absoluteAngles[cnt] - offset) * mAnimator.getPhaseY())) + center.x);
      float y=(float)(r * Math.sin(Math.toRadians((rotationAngle + absoluteAngles[cnt] - offset) * mAnimator.getPhaseY())) + center.y);
      float value=mChart.isUsePercentValuesEnabled() ? entry.getVal() / data.getYValueSum() * 100f : entry.getVal();
      ValueFormatter formatter=dataSet.getValueFormatter();
      boolean drawYVals=dataSet.isDrawValuesEnabled();
      if (drawXVals && drawYVals) {
        drawValue(c,formatter,value,entry,0,x,y);
        if (j < data.getXValCount())         c.drawText(data.getXVals().get(j),x,y + lineHeight,mValuePaint);
      }
 else       if (drawXVals && !drawYVals) {
        if (j < data.getXValCount())         c.drawText(data.getXVals().get(j),x,y + lineHeight / 2f,mValuePaint);
      }
 else       if (!drawXVals && drawYVals) {
        drawValue(c,formatter,value,entry,0,x,y + lineHeight / 2f);
      }
      cnt++;
    }
  }
}