Added Check to VerifyAlignment (#5675)

* Added missing EndTable() call to VerifyObject()

VerifyObject called VerifyTableStart() but not EndTable(). This made Verifier::VerifyComplexity() increase depth_ with each table, not with the depth of tables.

https://groups.google.com/forum/#!topic/flatbuffers/OpxtW5UFAdg

* Added Check to VerifyAlignment

https://stackoverflow.com/questions/59376308/flatbuffers-verifier-returns-false-without-any-assertion-flatbuffers-debug-veri
This commit is contained in:
stefan301
2019-12-23 18:08:35 +01:00
committed by Wouter van Oortmerssen
parent 13c05f4da3
commit 602721a735

View File

@@ -2143,7 +2143,7 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
} }
template<typename T> bool VerifyAlignment(size_t elem) const { template<typename T> bool VerifyAlignment(size_t elem) const {
return (elem & (sizeof(T) - 1)) == 0 || !check_alignment_; return Check((elem & (sizeof(T) - 1)) == 0 || !check_alignment_);
} }
// Verify a range indicated by sizeof(T). // Verify a range indicated by sizeof(T).