mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-04 12:43:24 +00:00
C++: Add option to skip verifying nested flatbuffers (#7489)
* C++: Add option to skip verifying nested flatbuffers Additionally, add an options struct to the verifier for those who prefer designated initializers to default arguments. The former constructor is defined in terms of the latter because in old c++, having default values for members removes list initialization, making defining constructors in the other way a lot more challenging to write. * fixes * fmt * formatting, and remove an argument * fix Co-authored-by: Casper Neo <cneo@google.com> Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
@@ -1085,6 +1085,14 @@ void NestedVerifierTest() {
|
||||
flatbuffers::Verifier verifier(builder.GetBufferPointer(),
|
||||
builder.GetSize());
|
||||
TEST_EQ(false, VerifyMonsterBuffer(verifier));
|
||||
|
||||
// Verify the root monster succeeds, since we've disabled checking nested
|
||||
// flatbuffers
|
||||
flatbuffers::Verifier::Options options;
|
||||
options.check_nested_flatbuffers = false;
|
||||
flatbuffers::Verifier no_check_nested(builder.GetBufferPointer(),
|
||||
builder.GetSize(), options);
|
||||
TEST_EQ(true, VerifyMonsterBuffer(no_check_nested));
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user