Program: 40344
Project: 40344
Buggy source:
@Override protected void decode(ChannelHandlerContext ctx,ByteBuf in,List<Object> out) throws Exception {
  if (in.readableBytes() < 8) {
    return;
  }
  in.markReaderIndex();
  byte protocolVersionValue=in.readByte();
  ProtocolVersion protocolVersion=ProtocolVersion.of(protocolVersionValue);
  BiFunction<ErrorCode,String,ErrorPdu> generateError=(code,text) -> {
    in.resetReaderIndex();
    byte[] content=new byte[in.readableBytes()];
    in.readBytes(content);
    return ErrorPdu.of(protocolVersion == null ? V1 : protocolVersion,code,content,text);
  }
;
  if (protocolVersion == null) {
    throw new RtrProtocolException(generateError.apply(ErrorCode.UnsupportedProtocolVersion,String.format("String_Node_Str",Byte.toUnsignedInt(protocolVersionValue))));
  }
  int pduType=in.readUnsignedByte();
switch (pduType) {
case SerialQueryPdu.PDU_TYPE:
{
      short sessionId=in.readShort();
      long length=in.readUnsignedInt();
      if (length != SerialQueryPdu.PDU_LENGTH) {
        throw new RtrProtocolException(generateError.apply(ErrorCode.InvalidRequest,String.format("String_Node_Str",SerialQueryPdu.PDU_LENGTH,length)));
      }
      if (in.readableBytes() + 8 < length) {
        return;
      }
      int serialNumber=in.readInt();
      out.add(SerialQueryPdu.of(protocolVersion,sessionId,SerialNumber.of(serialNumber)));
      break;
    }
case ResetQueryPdu.PDU_TYPE:
{
    @SuppressWarnings("String_Node_Str") int zero=in.readUnsignedShort();
    long length=in.readUnsignedInt();
    if (length != ResetQueryPdu.PDU_LENGTH) {
      throw new RtrProtocolException(generateError.apply(ErrorCode.InvalidRequest,String.format("String_Node_Str",ResetQueryPdu.PDU_LENGTH,length)));
    }
    out.add(ResetQueryPdu.of(protocolVersion));
    break;
  }
case ErrorPdu.PDU_TYPE:
{
  int errorCode=in.readUnsignedShort();
  long length=in.readUnsignedInt();
  if (length > Pdu.MAX_LENGTH) {
    throw new RtrProtocolException(generateError.apply(ErrorCode.InvalidRequest,String.format("String_Node_Str",Pdu.MAX_LENGTH,length)));
  }
  if (in.readableBytes() + 8 < length) {
    return;
  }
  long encapsulatedPduLength=in.readUnsignedInt();
  if (encapsulatedPduLength > length - 16) {
    throw new RtrProtocolException(generateError.apply(ErrorCode.InvalidRequest,String.format("String_Node_Str",encapsulatedPduLength,length - 16)));
  }
  byte[] encapsulatedPdu=new byte[(int)encapsulatedPduLength];
  in.readBytes(encapsulatedPdu);
  long errorTextLength=in.readUnsignedInt();
  if (errorTextLength > length - encapsulatedPduLength - 16) {
    throw new RtrProtocolException(generateError.apply(ErrorCode.InvalidRequest,String.format("String_Node_Str",errorTextLength,length - encapsulatedPduLength - 16)));
  }
  byte[] errorTextBytes=new byte[(int)errorTextLength];
  in.readBytes(errorTextBytes);
  out.add(ErrorPdu.of(protocolVersion,ErrorCode.of(errorCode),encapsulatedPdu,new String(errorTextBytes,StandardCharsets.UTF_8)));
  break;
}
default :
throw new RtrProtocolException(generateError.apply(ErrorCode.UnsupportedPduType,String.format("String_Node_Str",pduType)));
}
}

Fixed version (ground truth):
@Override protected void decode(ChannelHandlerContext ctx,ByteBuf in,List<Object> out) throws Exception {
  parsePdu(in).ifPresent(out::add);
}