Enable verifier on nested_flatbuffers

This commit is contained in:
Wouter van Oortmerssen
2021-11-22 17:07:49 -08:00
parent 4d0e9a8706
commit 0fadaf391d
5 changed files with 38 additions and 14 deletions

View File

@@ -183,6 +183,14 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
// clang-format on
}
template<typename T>
bool VerifyNestedFlatBuffer(const Vector<uint8_t> *buf,
const char *identifier) {
if (!buf) return true;
Verifier nested_verifier(buf->data(), buf->size());
return nested_verifier.VerifyBuffer<T>(identifier);
}
// Verify this whole buffer, starting with root type T.
template<typename T> bool VerifyBuffer() { return VerifyBuffer<T>(nullptr); }