Program: 47835
Project: 47835
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;
  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;
  }
}

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 boolean allAscii=in.readBoolean();
  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;
    }
  }
}