VerifySizePrefixed (reflection::Schema) and GetAnySizePrefixedRoot added (#7181)

* Typo in flatc options (warning-as-errors instead of warnings-as-errors)

* VerifySizePrefixed (reflection::Schema) and GetAnySizePrefixedRoot added

* some review comments

* more review comments
This commit is contained in:
Stefan F
2022-03-24 05:39:38 +01:00
committed by GitHub
parent 5a13f622cf
commit 4213d91054
2 changed files with 29 additions and 5 deletions

View File

@@ -736,10 +736,20 @@ bool VerifyObject(flatbuffers::Verifier &v, const reflection::Schema &schema,
}
bool Verify(const reflection::Schema &schema, const reflection::Object &root,
const uint8_t *buf, size_t length, uoffset_t max_depth /*= 64*/,
uoffset_t max_tables /*= 1000000*/) {
const uint8_t *const buf, const size_t length,
const uoffset_t max_depth, const uoffset_t max_tables) {
Verifier v(buf, length, max_depth, max_tables);
return VerifyObject(v, schema, root, flatbuffers::GetAnyRoot(buf), true);
return VerifyObject(v, schema, root, flatbuffers::GetAnyRoot(buf),
/*required=*/true);
}
bool VerifySizePrefixed(const reflection::Schema &schema,
const reflection::Object &root,
const uint8_t *const buf, const size_t length,
const uoffset_t max_depth, const uoffset_t max_tables) {
Verifier v(buf, length, max_depth, max_tables);
return VerifyObject(v, schema, root, flatbuffers::GetAnySizePrefixedRoot(buf),
/*required=*/true);
}
} // namespace flatbuffers