Skip to content

Field type mismatch is not detected when loading a message #31

@modersohn

Description

@modersohn

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions