Program: 47804
Project: 47804
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 int minUtfLenght=Math.min(utfLength,buffer.length - 1);
  int readCount=0;
  int bufferPos=1;
  int i=0;
  int c1=0, c2=0, c3=0, cTemp=0;
  int charArrCount=beginIndex;
  in.readFully(buffer,1,minUtfLenght);
  for (; i < minUtfLenght; i++) {
    if ((c1=buffer[bufferPos++] & 0xFF) > 127) {
      break;
    }
    data[charArrCount++]=(char)c1;
  }
  for (; i < utfLength; i++) {
    if (c1 > 127) {
      break;
    }
    data[charArrCount++]=(char)c1;
    bufferPos=buffered(buffer,bufferPos,utfLength,in);
    c1=buffer[0] & 0xFF;
  }
  for (readCount=i; 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,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,in);
      c2=buffer[0] & 0xFF;
      bufferPos=buffered(buffer,bufferPos,utfLength,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,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();
  final int minUtfLenght=Math.min(utfLength,buffer.length - 1);
  int readCount=0;
  int bufferPos=1;
  int i=0;
  int c1=0;
  int c2=0;
  int c3=0;
  int cTemp=0;
  int charArrCount=beginIndex;
  in.readFully(buffer,1,minUtfLenght);
  for (; i < minUtfLenght; i++) {
    c1=buffer[bufferPos++] & 0xFF;
    if (c1 > 127) {
      break;
    }
    data[charArrCount++]=(char)c1;
  }
  for (; i < utfLength; i++) {
    if (c1 > 127) {
      break;
    }
    data[charArrCount++]=(char)c1;
    bufferPos=buffered(buffer,bufferPos,utfLength,in);
    c1=buffer[0] & 0xFF;
  }
  for (readCount=i; 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,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,in);
      c2=buffer[0] & 0xFF;
      bufferPos=buffered(buffer,bufferPos,utfLength,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,in);
    c1=buffer[0] & 0xFF;
  }
}