• Thomas Van Lenten's avatar
    Validate the tag numbers when parsing. (#1725) · c18aa779
    Thomas Van Lenten authored
    There was a twist code path (that some times showed up due to what happened to
    be in memory in failure cases), that would cast a bogus wire type into the
    enum, and then fall through switch statements.
    
    Resolve this by validating all wire types when parsing tags and throwing the
    error at that point so it can't enter the system.
    
    As added safety, stick in a few asserts for apis that get passed tags to ensure
    they also are only seeing valid data.
    
    Bonus: Tweak the parsing loop to skip some work when we get the end marker
    (zero tag) instead of still looping through all the fields.
    c18aa779
GPBWireFormat.h 3 KB