Repository navigation
Conversation
Verifier.GetVRelOffset narrowed a table's absolute vtable position to 16 bits via Convert.ToInt16. For any table located past offset 32767 (common once a buffer exceeds ~32KB) the conversion throws, the surrounding try/catch swallows it, and GetVRelOffset returns 0 so every field of that table is treated as absent. The runtime accessor Table.__offset reads the same position as an int, so the verifier and the reader disagree: a well-formed buffer whose tables cross the 32KB mark is wrongly rejected, and a malformed field in such a table is skipped instead of verified. Store the vtable position in an int to match Table.__offset. Tested with the existing FlatBuffers.Test suite plus a new regression (TestVerifierVtableBeyond32k) that verifies an identical valid Monster both below and above the 32KB boundary; it fails before the change and passes after.
Contributor
|
Could you please look at these PRs that want to fix the same Bug in GetVRelOffset in FlatBufferVerify.cs: Thanks |
This was referenced Oct 28, 2026
[C#] Fix incorrect offset type in verifier (https://github.com/google/flatbuffers/issues/8937)
#9242
Open
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Verifier.GetVRelOffset truncates a table's absolute vtable position to 16 bits with Convert.ToInt16, so for any table past offset 32767 the conversion throws, the catch swallows it, and every field of that table is treated as absent. The runtime Table.__offset reads the same position as an int, so a well-formed buffer whose tables cross the 32KB mark is wrongly rejected, and a malformed field in such a table is skipped instead of verified. Store the vtable position in an int to match the accessor; the added regression test verifies the same valid Monster below and above the boundary.