Comment #4 on issue 593 by dave.b...@gmail.com: FatalException on calling SerializeAsString()
http://code.google.com/p/protobuf/issues/detail?id=593


This exact same issue occurs for me too - and when I replace the usage of all bools with uint32s, the problem goes away.

Looking through the source code, it seems that the only way in which the _has_error flag can be set is if _Next returns false. The check that dies is in message_lite.cc:224, and from a cursor examination the only code path that would cause the error is if the return value of GetCachedSize() is insufficient to serialise the message.

The reason this happens with bools is that a bool is always considered to be one byte, but if your bool value is unitialised (as mine was) then when protobuf actually tries to serialise the value it may end up using more than one byte.

IMHO protobuf should assert if you try to set a value other than 0 or 1 into a bool. This would catch the error where it actually occurs, rather than later on when it attempts to serialise the data.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to