In the unlikely, but not impossible event, that a messages field types do not match, the generated LoadFromBuf methods will not detect this mismatch and just load the number of bytes that they are expecting according to their field definition.
This will offset the byte stream, so that all following fields of this message are read incorrectly which results in highly unpredictable behaviour.
One solution would be to add a check either to the generated LoadFromBuf methods, or even to the readXXX (not the readRawXXX) methods - using FLastTag and getTagWireType.
The question is, what should be done in case of an error:
- the field could be skipped and the remainder of the message could be loaded,
- but then how to log an error?
- raise an exception afterwards?
In the unlikely, but not impossible event, that a messages field types do not match, the generated LoadFromBuf methods will not detect this mismatch and just load the number of bytes that they are expecting according to their field definition.
This will offset the byte stream, so that all following fields of this message are read incorrectly which results in highly unpredictable behaviour.
One solution would be to add a check either to the generated LoadFromBuf methods, or even to the readXXX (not the readRawXXX) methods - using FLastTag and getTagWireType.
The question is, what should be done in case of an error: