mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-17 01:26:45 +00:00
Verify everything in one shot
This commit is contained in:
@@ -1314,7 +1314,12 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
|
||||
}
|
||||
|
||||
// Verify this whole buffer, starting with root type T.
|
||||
template<typename T> bool VerifyBuffer() {
|
||||
template<typename T> bool VerifyBuffer(const char *identifier) {
|
||||
if (identifier && (size_t(end_ - buf_) < 2 * sizeof(flatbuffers::uoffset_t) ||
|
||||
!BufferHasIdentifier(buf_, identifier))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Call T::Verify, which must be in the generated code for this type.
|
||||
return Verify<uoffset_t>(buf_) &&
|
||||
reinterpret_cast<const T *>(buf_ + ReadScalar<uoffset_t>(buf_))->
|
||||
|
||||
Reference in New Issue
Block a user