Program: 174182
Project: 174182
Buggy source:
private void processBuf() throws IOException {
  int readBytes=0;
  if (state == State.START || state == State.HEADERS) {
    String[] lines=new String(buf,0,bufLimit).split("String_Node_Str",-1);
    if (lines.length <= 1) {
      return;
    }
    for (int i=0; i < lines.length - 1; i++) {
      String line=lines[i];
      readBytes+=line.length() + 2;
      if (state == State.START) {
        if (checkStart(line)) {
          lastActive=System.currentTimeMillis();
          state=State.HEADERS;
          headersMap.clear();
        }
      }
 else       if (state == State.HEADERS) {
        if (line.isEmpty()) {
          if (contentLength < 0) {
            lastActive=System.currentTimeMillis();
            finish();
            state=State.START;
          }
 else {
            state=State.BODY;
          }
          break;
        }
 else {
          String[] kv=line.split("String_Node_Str",2);
          if (kv.length == 2) {
            lastActive=System.currentTimeMillis();
            String key=kv[0].trim().toLowerCase();
            String value=kv[1].trim();
            headersMap.computeIfAbsent(key,k -> new ArrayList<>()).add(value);
            if (key.equals("String_Node_Str")) {
              contentLength=Integer.valueOf(value);
              if (contentLength > MAX_BODY_LENGTH) {
                error();
                state=State.START;
              }
 else {
                body=new byte[contentLength];
                bodyLimit=0;
              }
            }
          }
 else {
            error();
            state=State.START;
          }
        }
      }
    }
  }
  if (state == State.BODY) {
    lastActive=System.currentTimeMillis();
    int canRead=bufLimit - readBytes;
    if (canRead >= contentLength - bodyLimit) {
      canRead=contentLength - bodyLimit;
    }
    System.arraycopy(buf,readBytes,body,bodyLimit,canRead);
    readBytes+=canRead;
    bodyLimit+=canRead;
    if (bodyLimit >= contentLength) {
      readBytes=bufLimit;
      finish();
      state=State.START;
    }
  }
  if (readBytes < bufLimit) {
    System.arraycopy(buf,readBytes,buf,0,bufLimit - readBytes);
  }
  bufLimit-=readBytes;
}

Fixed version (ground truth):
private void processBuf() throws IOException {
  int readBytes=0;
  if (state == State.START || state == State.HEADERS) {
    String[] lines=new String(buf,0,bufLimit).split("String_Node_Str",-1);
    if (lines.length <= 1) {
      return;
    }
    for (int i=0; i < lines.length - 1; i++) {
      String line=lines[i];
      readBytes+=line.getBytes().length + 2;
      if (state == State.START) {
        if (checkStart(line)) {
          lastActive=System.currentTimeMillis();
          state=State.HEADERS;
          headersMap.clear();
        }
      }
 else       if (state == State.HEADERS) {
        if (line.isEmpty()) {
          if (contentLength < 0) {
            lastActive=System.currentTimeMillis();
            finish();
            state=State.START;
          }
 else {
            state=State.BODY;
          }
          break;
        }
 else {
          String[] kv=line.split("String_Node_Str",2);
          if (kv.length == 2) {
            lastActive=System.currentTimeMillis();
            String key=kv[0].trim().toLowerCase();
            String value=kv[1].trim();
            headersMap.computeIfAbsent(key,k -> new ArrayList<>()).add(value);
            if (key.equals("String_Node_Str")) {
              contentLength=Integer.valueOf(value);
              if (contentLength > MAX_BODY_LENGTH) {
                error();
                state=State.START;
              }
 else {
                body=new byte[contentLength];
                bodyLimit=0;
              }
            }
          }
 else {
            error();
            state=State.START;
          }
        }
      }
    }
  }
  if (state == State.BODY) {
    lastActive=System.currentTimeMillis();
    int canRead=bufLimit - readBytes;
    if (canRead >= contentLength - bodyLimit) {
      canRead=contentLength - bodyLimit;
    }
    System.arraycopy(buf,readBytes,body,bodyLimit,canRead);
    readBytes+=canRead;
    bodyLimit+=canRead;
    if (bodyLimit >= contentLength) {
      readBytes=bufLimit;
      finish();
      state=State.START;
    }
  }
  if (readBytes < bufLimit) {
    System.arraycopy(buf,readBytes,buf,0,bufLimit - readBytes);
  }
  bufLimit-=readBytes;
}