This helps to detect and report parsing errors better. The patch follows the ideas of LLDB's patches D59370 and D59381.
It adds tests for valid and some invalid cases. More checks and tests to come. Note that the patch fixes validation of the Length field because the value does not include the field itself.
Might this eventually want to go in the direction of having fallible errors and errors that can continue, like some of @jhenderson 's work? Should we come up with a consistent strategy for this sort of thing as it seems we've developed a few different error handling parsing schemes at this point.