Currently Message::ParseFromBoundedZeroCopyStream() doesn't guarantee
that it will never attempt to read beyond the specified size.

I have seen cases where a Next() is issued on the underlying stream,
after the message has been successfully parsed, and the limit is hit.

There is an implicit assumption in CodedInputStream limit management
that reading past the limit will either return an EOF or some data
which can be BackUp()ed onto the stream.

This works well with files. However this can cause trouble when the
underlying stream is a network socket.
We may not hit EOF since the connection is open while the other side
is waiting for the response; and there is no more data that can be
read either. This can cause the Next() on the underlying stream to get

Is it fine to fix this such a way that it will never attempt to read
once the limit is hit?

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to