Program: 47745
Project: 47745
Buggy source:
private void readShortUTF(final DataInput in,final char[] data,final int beginIndex,final byte[] buffer) throws IOException {
  final int utfLength=in.readShort();
  final boolean allAscii=ASCII_AWARE ? in.readBoolean() : false;
  final int minUtfLenght=Math.min(utfLength,buffer.length - 1);
  final int bufferLimit=minUtfLenght + 1;
  int readCount=0;
  int bufferPos=1;
  int c1=0;
  int c2=0;
  int c3=0;
  int cTemp=0;
  int charArrCount=beginIndex;
  in.readFully(buffer,1,minUtfLenght);
  if (allAscii) {
    while (bufferPos != bufferLimit) {
      data[charArrCount++]=(char)(buffer[bufferPos++] & 0xFF);
    }
    for (readCount=bufferPos - 1; readCount < utfLength; readCount++) {
      bufferPos=buffered(buffer,bufferPos,utfLength,readCount,in);
      data[charArrCount++]=(char)(buffer[0] & 0xFF);
    }
  }
 else {
    while (bufferPos != bufferLimit) {
      c1=buffer[bufferPos++] & 0xFF;
      if (c1 > 127) {
        bufferPos--;
        break;
      }
      data[charArrCount++]=(char)c1;
    }
    readCount=bufferPos - 1;
    if (bufferPos == bufferLimit) {
      bufferPos=buffered(buffer,bufferPos,utfLength,readCount,in);
      c1=buffer[0] & 0xFF;
    }
    while (readCount < utfLength) {
      cTemp=c1 >> 4;
      if (cTemp >> 3 == 0) {
        data[charArrCount++]=(char)c1;
        readCount++;
      }
 else       if (cTemp == 12 || cTemp == 13) {
        if (readCount + 1 > utfLength) {
          throw new UTFDataFormatException("String_Node_Str");
        }
        bufferPos=buffered(buffer,bufferPos,utfLength,readCount,in);
        c2=buffer[0] & 0xFF;
        if ((c2 & 0xC0) != 0x80) {
          throw new UTFDataFormatException("String_Node_Str" + beginIndex + readCount+ 1);
        }
        data[charArrCount++]=(char)(((c1 & 0x1F) << 6) | (c2 & 0x3F));
        readCount+=2;
      }
 else       if (cTemp == 14) {
        if (readCount + 2 > utfLength) {
          throw new UTFDataFormatException("String_Node_Str");
        }
        bufferPos=buffered(buffer,bufferPos,utfLength,readCount,in);
        c2=buffer[0] & 0xFF;
        bufferPos=buffered(buffer,bufferPos,utfLength,readCount,in);
        c3=buffer[0] & 0xFF;
        if (((c2 & 0xC0) != 0x80) || ((c3 & 0xC0) != 0x80)) {
          throw new UTFDataFormatException("String_Node_Str" + (beginIndex + readCount + 1));
        }
        data[charArrCount++]=(char)(((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | ((c3 & 0x3F)));
        readCount+=3;
      }
 else {
        throw new UTFDataFormatException("String_Node_Str" + (beginIndex + readCount));
      }
      bufferPos=buffered(buffer,bufferPos,utfLength,readCount,in);
      c1=buffer[0] & 0xFF;
    }
  }
}

Fixed version (ground truth):
private void readShortUTF(final DataInput in,final char[] data,final int beginIndex,final byte[] buffer) throws IOException {
  final int utfLength=in.readShort() & 0xFFFF;
  final boolean allAscii=ASCII_AWARE ? in.readBoolean() : false;
  final int minUtfLenght=Math.min(utfLength,buffer.length - 1);
  final int bufferLimit=minUtfLenght + 1;
  int readCount=0;
  int bufferPos=1;
  int c1=0;
  int c2=0;
  int c3=0;
  int cTemp=0;
  int charArrCount=beginIndex;
  in.readFully(buffer,1,minUtfLenght);
  if (allAscii) {
    while (bufferPos != bufferLimit) {
      data[charArrCount++]=(char)(buffer[bufferPos++] & 0xFF);
    }
    for (readCount=bufferPos - 1; readCount < utfLength; readCount++) {
      bufferPos=buffered(buffer,bufferPos,utfLength,readCount,in);
      data[charArrCount++]=(char)(buffer[0] & 0xFF);
    }
  }
 else {
    c1=buffer[bufferPos++] & 0xFF;
    while (bufferPos != bufferLimit) {
      if (c1 > 127) {
        break;
      }
      data[charArrCount++]=(char)c1;
      c1=buffer[bufferPos++] & 0xFF;
    }
    bufferPos--;
    readCount=bufferPos - 1;
    while (readCount < utfLength) {
      bufferPos=buffered(buffer,bufferPos,utfLength,readCount++,in);
      c1=buffer[0] & 0xFF;
      cTemp=c1 >> 4;
      if (cTemp >> 3 == 0) {
        data[charArrCount++]=(char)c1;
      }
 else       if (cTemp == 12 || cTemp == 13) {
        if (readCount + 1 > utfLength) {
          throw new UTFDataFormatException("String_Node_Str");
        }
        bufferPos=buffered(buffer,bufferPos,utfLength,readCount++,in);
        c2=buffer[0] & 0xFF;
        if ((c2 & 0xC0) != 0x80) {
          throw new UTFDataFormatException("String_Node_Str" + beginIndex + readCount+ 1);
        }
        data[charArrCount++]=(char)(((c1 & 0x1F) << 6) | (c2 & 0x3F));
      }
 else       if (cTemp == 14) {
        if (readCount + 2 > utfLength) {
          throw new UTFDataFormatException("String_Node_Str");
        }
        bufferPos=buffered(buffer,bufferPos,utfLength,readCount++,in);
        c2=buffer[0] & 0xFF;
        bufferPos=buffered(buffer,bufferPos,utfLength,readCount++,in);
        c3=buffer[0] & 0xFF;
        if (((c2 & 0xC0) != 0x80) || ((c3 & 0xC0) != 0x80)) {
          throw new UTFDataFormatException("String_Node_Str" + (beginIndex + readCount + 1));
        }
        data[charArrCount++]=(char)(((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | ((c3 & 0x3F)));
      }
 else {
        throw new UTFDataFormatException("String_Node_Str" + (beginIndex + readCount));
      }
    }
  }
}