Ok, that was my real mistake, i.e. passing the buffer size vs. the
On Dec 17, 12:45 pm, Kenton Varda <
ken...@google.com> wrote:
> When you call ParseFromArray(), you must pass the exact size of the message
> being parsed. You cannot simply give it the size of the buffer if there are
> extra bytes after the end of the message.
> What happened here is that the parser, after parsing the bytes of your
> actual message, continued to interpret the following bytes as more data.
> The next byte was a 1, which the parser thought was indicating the
> beginning of a 64-bit fixed-width field with field number zero. Since your
> message does not declare a field number zero (you actually aren't allowed
> to), it treated this as an unknown field and stored the value in the
> UnknownFieldSet. Later, when you serialized the message, the value in the
> UnknownFieldSet was written out again.
>
> The moral of the story is that you must transmit the size of your message
> along with the data, so that you can pass it to ParseFromArray() on the
> receiving end.
>