Program: 63461
Project: 63461
Buggy source:
public boolean read(ByteBuffer buffer) throws MessageParseException {
  for (; ; ) {
    try {
      if (state == SEEKING_HEADER) {
        if (buffer.remaining() < headerBytes.length) {
          break;
        }
        messageStartPosition=indexOf(buffer,buffer.position(),headerBytes);
        if (messageStartPosition == -1) {
          throw new MessageParseException("String_Node_Str" + "String_Node_Str");
        }
        log.debug("String_Node_Str");
        position=messageStartPosition + headerBytes.length;
        state=PARSING_LENGTH;
      }
      if (state == PARSING_LENGTH) {
        bodyLength=0;
        byte ch=buffer.get(position++);
        while (Character.isDigit((char)ch)) {
          bodyLength=bodyLength * 10 + (ch - '0');
          if (buffer.hasRemaining()) {
            ch=buffer.get(position++);
          }
 else {
            break;
          }
        }
        if (ch != '\001') {
          handleError(buffer,"String_Node_Str",false);
          break;
        }
        bodyStartPosition=position;
        state=READING_BODY;
        log.debug("String_Node_Str" + bodyLength);
      }
      if (state == READING_BODY) {
        if ((buffer.limit() - position) < bodyLength) {
          break;
        }
        position+=bodyLength;
        state=PARSING_CHECKSUM;
      }
      if (state == PARSING_CHECKSUM) {
        if (startsWith(buffer,position,checksumBytes)) {
          log.debug("String_Node_Str");
          position+=checksumBytes.length;
        }
 else {
          handleError(buffer,"String_Node_Str",isLogon(buffer,messageStartPosition));
          if (buffer.remaining() > 0) {
            continue;
          }
 else {
            break;
          }
        }
        byte[] data=new byte[position - messageStartPosition];
        buffer.position(messageStartPosition);
        buffer.get(data);
        message=new String(data);
        if (log.isTraceEnabled()) {
          log.trace("String_Node_Str" + message + "String_Node_Str"+ buffer.remaining());
        }
        return true;
      }
    }
 catch (    Throwable t) {
      state=SEEKING_HEADER;
      throw new MessageParseException(t);
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean read(ByteBuffer buffer) throws MessageParseException {
  for (; ; ) {
    try {
      if (state == SEEKING_HEADER) {
        if (buffer.remaining() < headerBytes.length) {
          break;
        }
        messageStartPosition=indexOf(buffer,buffer.position(),headerBytes);
        if (messageStartPosition == -1) {
          throw new MessageParseException("String_Node_Str" + "String_Node_Str");
        }
        log.debug("String_Node_Str");
        position=messageStartPosition + headerBytes.length;
        state=PARSING_LENGTH;
      }
      if (state == PARSING_LENGTH) {
        if (position >= buffer.limit()) {
          break;
        }
        bodyLength=0;
        byte ch=buffer.get(position++);
        while (Character.isDigit((char)ch)) {
          bodyLength=bodyLength * 10 + (ch - '0');
          if (position < buffer.limit()) {
            ch=buffer.get(position++);
          }
 else {
            break;
          }
        }
        if (position >= buffer.limit()) {
          break;
        }
        if (ch != '\001') {
          handleError(buffer,"String_Node_Str",false);
          break;
        }
        bodyStartPosition=position;
        state=READING_BODY;
        log.debug("String_Node_Str" + bodyLength);
      }
      if (state == READING_BODY) {
        if ((buffer.limit() - position) < bodyLength) {
          break;
        }
        position+=bodyLength;
        state=PARSING_CHECKSUM;
      }
      if (state == PARSING_CHECKSUM) {
        if (startsWith(buffer,position,checksumBytes)) {
          log.debug("String_Node_Str");
          position+=checksumBytes.length;
        }
 else {
          if (position + checksumBytes.length < buffer.limit()) {
            handleError(buffer,"String_Node_Str",isLogon(buffer,messageStartPosition));
            if (buffer.remaining() > 0) {
              continue;
            }
 else {
              break;
            }
          }
 else {
            break;
          }
        }
        byte[] data=new byte[position - messageStartPosition];
        buffer.position(messageStartPosition);
        buffer.get(data);
        message=new String(data);
        if (log.isTraceEnabled()) {
          log.trace("String_Node_Str" + message + "String_Node_Str"+ buffer.remaining());
        }
        return true;
      }
    }
 catch (    Throwable t) {
      state=SEEKING_HEADER;
      throw new MessageParseException(t);
    }
  }
  return false;
}