The CodedInputStream(byte[], int, int), the setting of: bufferSize = *off+ *
would appear to be an error.  I expect it should be: bufferSize = len;
(generally, bufferSize is the max value of bufferPos in the buffer byte[])

This leads to various confusion and ArrayIndexOutOfBoundsException when 
using a byte[] slice.

For example: CodedInputStream.newInstance("AAAAA".getBytes(), 
5,5).isAtEnd() --> *false* [when obviously the buffer is 'empty' at this 
and readBytes() will likewise expect to find more bytes than are actually 
in the byte[]

Note: There are other inconsistencies (wrt bufferSize & totalBytesRetired) 
in refillBuffer, where bufferSize is not what it seems (when using a byte[] 

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To view this discussion on the web visit
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