How to change the buffer limit in Google's protobuf?
c++, protocol-buffers
Solution
The correct fix: You should try to limit the sizes of your protobuf messages. Please see: https://developers.google.com/protocol-buffers/docs/techniques#streaming
The quick and dirty (read not recommended) approach: In the file coded_stream.h of the protobuf library source, change the values of `kDefaultTotalBytesLimit` and `kDefaultTotalBytesWarningThreshold`, recompile, and reinstall.
Problem
I'm getting this warning and an error afterwards when I try to parse a large message. I know than 64MB which is the default limit. I am using message.ParseFromIstream now. Does any one know to get access to CodedInputStream object to call the SetTotalBytesLimit function? or any other way to solve this problem? 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.