protobuf-c/protobuf-c — pull request #137 by anight (2014-03-30 14:01:39+00:00)
Title: reverted required_fields_bitmap behavour introduced by 248eae1d

Apparently 248eae1d has introduced a serious problem to protobuf-c decoder.

Originally the function of required_fields_bitmap was to prevent
decoder from returning incomplete messages. That means, each required
field in the message either must have a default_value or be present in the
protobuf stream. The purpose of this behavour was to provide user with
100% complete ProtobufCMessage struct on return from protobuf_c_message_unpack(),
which does not need to be checked for completeness just after. This is exactly
how original protobuf c++ decoder behaves. The patch 248eae1d broke this
functionality by hashing bits of required fields instead of storing them
separately.

Consider a protobuf message with 129 fields where the first and the last
fields set as 'required'. In this case it is possible to trick decoder
to return incomplete ProtobufCMessage struct with missing required fields by
providing only one of the two fields in the source byte stream. This can be
considered as a security issue as well because user's code do not expect
incomplete messages with missing required fields out from
protobuf_c_message_unpack(). Such a change could introduce undefined behavour
to user programms.