Size verifier fix 2 (#8740)

* Fixes to make SizeVerifier work.

In particular change all the places in the Flatbuffers library
and generated code that were using `Verifier` to instead use
`VerifierTemplate<TrackBufferSize>` and wrap them all inside
`template <bool TrackBufferSize = false>`.

Also add unit tests for SizeVerifier.

* Format using `sh scripts/clang-format-git.sh`

* Use `B` rather than `TrackBufferSize` for the name of the template parameter.

* Update generated files.
This commit is contained in:
Fergus Henderson
2025-11-24 12:11:32 +00:00
committed by GitHub
parent 7ea8db05d8
commit 20548ff3b6
30 changed files with 588 additions and 305 deletions

View File

@@ -4352,8 +4352,9 @@ bool Parser::Deserialize(const uint8_t* buf, const size_t size) {
else
size_prefixed = true;
}
auto verify_fn = size_prefixed ? &reflection::VerifySizePrefixedSchemaBuffer
: &reflection::VerifySchemaBuffer;
auto verify_fn = size_prefixed
? &reflection::VerifySizePrefixedSchemaBuffer<false>
: &reflection::VerifySchemaBuffer<false>;
if (!verify_fn(verifier)) {
return false;
}