Fix --annotated + --size-prefixed generating empty annotated files#8976
Open
dataCenter430 wants to merge 1 commit intogoogle:masterfrom
Open
Fix --annotated + --size-prefixed generating empty annotated files#8976dataCenter430 wants to merge 1 commit intogoogle:masterfrom
dataCenter430 wants to merge 1 commit intogoogle:masterfrom
Conversation
Contributor
Author
|
Hi, @dbaileychess |
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.
Closes: #8953
Summary
flatc --size-prefixed --annotated <schema>.fbs -- <binary>would generate an almost empty annotated file.BinaryAnnotatoris always validated as a normal (non–size-prefixed) schema, independent of whether the input binary is size-prefixed.is_size_prefixed_scoped correctly to parsing the data buffer header only.Description
Previously,
BinaryAnnotator::Annotatevalidated the schema buffer like this:is_size_prefixed_was true (because the input binary was size-prefixed), it attemptedreflection::VerifySizePrefixedSchemaBuffer.reflection::VerifySchemaBufferfailed, it returned an empty section map.In the
--annotatedflow, the schema (.bfbs) is not size-prefixed, even when the binary data is. This caused schema verification to fail when--size-prefixedwas used, leading to an empty annotation result and an almost empty.afbfile.This PR changes
BinaryAnnotator::Annotateto always validate the schema using: