Skip to content

upb: validate message tags before consuming depth - #29514

Open
srkyn wants to merge 1 commit into
protocolbuffers:mainfrom
srkyn:research/fasttable-tag-depth-order
Open

upb: validate message tags before consuming depth#29514
srkyn wants to merge 1 commit into
protocolbuffers:mainfrom
srkyn:research/fasttable-tag-depth-order

Conversation

@srkyn

@srkyn srkyn commented Aug 29, 2026

Copy link
Copy Markdown

Summary

  • Validate a linked-message fasttable slot against the actual tag before entering the message path.
  • Keep mismatched tags on the existing fallback path.
  • Add a regression test for a valid unknown field at an exact recursion-depth boundary.

Without this ordering, the fast decoder can return MaxDepthExceeded for a valid message that the generic decoder accepts because it consumes depth before discovering that the tag does not match the message slot.

Testing

  • DecodeTest.MismatchedMessageSlotDoesNotConsumeDepth passes with the fast and generic decoders.
  • Full sanitized upb-test: 535 passed, 1 existing skip.
  • Patched current-main differential fuzzing: 1,000,000 executions with no decoder mismatch or sanitizer finding.
  • Patched v36 differential fuzzing: 3,000,000 executions with no decoder mismatch or sanitizer finding.

Check that a linked message fasttable slot matches the actual tag before looking up the subtable or entering the message path. This keeps mismatched tags on the fallback path and avoids rejecting valid unknown fields at an exact recursion boundary.

Signed-off-by: David Sarkisyan <david@srkyn.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant