I am making an app with protobuf-net, using it for sending/receiving data over the network.
I am curious whether/how someone can send something that will make this line throw an exception:
var message = Serializer.DeserializeWithLengthPrefix<ReceiveType>(
memoryStream, PrefixStyle.Fixed32);
I am assuming that by this point we've checked that:
- (Edit) Entire message has already been received and was placed into a
MemoryStream
, which will be used for deserializing the message (i.e. no risk of the stream cutting off). - The length prefix contains a number of reasonable size (i.e. won't run out of memory)
- Message body is exactly as large as promised by the prefix.
So far I've tried various possibilities, and at worst the message
fields come out to be null
or other default values, even for the required fields and when the message body contains random gibberish.