Skip to content

Fix Thrift union __type property bounds check in spec-holder#9742

Open
cuiweixie wants to merge 1 commit into
facebook:masterfrom
cuiweixie:fix/thrift-union-__type-bounds-check
Open

Fix Thrift union __type property bounds check in spec-holder#9742
cuiweixie wants to merge 1 commit into
facebook:masterfrom
cuiweixie:fix/thrift-union-__type-bounds-check

Conversation

@cuiweixie
Copy link
Copy Markdown

Summary

Fix an off-by-one in compileSpec when validating the extra __type property for Thrift unions.

When numDeclProperties() equals spec.size(), there is no property at declProperties()[spec.size()] (indices are 0 .. numDeclProperties()-1). The previous check used <, which allowed that case and could read past the end of declProperties().

Test plan

  • CI / local build as appropriate for this area.

When the number of declared properties equals the TSPEC field count, the
extra __type slot at declProperties()[spec.size()] does not exist. Use <=
instead of < so we do not read past the end of declProperties().
@meta-cla meta-cla Bot added the CLA Signed label Mar 28, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Mar 28, 2026

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this in D98601431. (Because this pull request was imported automatically, there will not be any future comments.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant