diff --git a/include/flatbuffers/verifier.h b/include/flatbuffers/verifier.h index c8a88eefe..d100bf48c 100644 --- a/include/flatbuffers/verifier.h +++ b/include/flatbuffers/verifier.h @@ -164,10 +164,11 @@ class Verifier FLATBUFFERS_FINAL_CLASS { // gives the result we want. auto vtableo = tableo - static_cast(ReadScalar(table)); // Check the vtable size field, then check vtable fits in its entirety. - return VerifyComplexity() && Verify(vtableo) && + if (!( VerifyComplexity() && Verify(vtableo) && VerifyAlignment(ReadScalar(buf_ + vtableo), - sizeof(voffset_t)) && - Verify(vtableo, ReadScalar(buf_ + vtableo)); + sizeof(voffset_t)))) return false; + auto vsize = ReadScalar(buf_ + vtableo); + return Check((vsize & 1) == 0) && Verify(vtableo, vsize); } template