Status: New
Labels: Type-Defect Priority-Medium

New issue 234 by eschew: bool values not normalized before serialization

protobuf seems to assume that every bool value is representationally equal to either true or false, rather than merely operationally equivalent.

If a bool with a bit-pattern that is not 0 or 1 is passed to a message field's setter, serializing the message results in silent corruption of the serialized message.

I don't know offhand to what degree the C++ standard constrains the implementation of bools. It seems safe to classify this as a client correctness issue, rather than a problem with protobuf itself. Still, protobuf checks for other client problems such as trying to serialize incomplete messages, so it might make sense for protobuf to perform normalization of incoming bool values.

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