+-
c – 如何更改Google protobuf中的缓冲区限制?
当我尝试解析一条大邮件时,我收到此警告并出现错误.我知道64MB是默认限制.我现在正在使用message.ParseFromIstream.有没有人知道访问CodedInputStream对象来调用SetTotalBytesLimit函数?或任何其他方式来解决这个问题?

Reading dangerously large protocol message. If the message turns out
to be larger than 67108864 bytes, parsing will be halted for security
reasons. To increase the limit (or to disable these warnings), see
CodedInputStream::SetTotalBytesLimit() in
google/protobuf/io/coded_stream.h.

最佳答案
正确的解决方法:您应该尝试限制protobuf消息的大小.请参见:
https://developers.google.com/protocol-buffers/docs/techniques#streaming

快速而肮脏的(不推荐阅读)方法:
在protobuf库源的coded_stream.h文件中,更改kDefaultTotalBytesLimit和kDefaultTotalBytesWarningThreshold的值,重新编译并重新安装.

点击查看更多相关文章

转载注明原文:c – 如何更改Google protobuf中的缓冲区限制? - 乐贴网