mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-08 22:20:56 +00:00
Verifier for FlexBuffers (#6977)
* Verifier for FlexBuffers * Verifier improvements & fuzzer
This commit is contained in:
committed by
GitHub
parent
705f27f6ee
commit
e367ca32ad
@@ -265,6 +265,12 @@ struct JsonPrinter {
|
||||
val = reinterpret_cast<const Struct *>(table)->GetStruct<const void *>(
|
||||
fd.value.offset);
|
||||
} else if (fd.flexbuffer && opts.json_nested_flexbuffers) {
|
||||
// We could verify this FlexBuffer before access, but since this sits
|
||||
// inside a FlatBuffer that we don't know wether it has been verified or
|
||||
// not, there is little point making this part safer than the parent..
|
||||
// The caller should really be verifying the whole.
|
||||
// If the whole buffer is corrupt, we likely crash before we even get
|
||||
// here.
|
||||
auto vec = table->GetPointer<const Vector<uint8_t> *>(fd.value.offset);
|
||||
auto root = flexbuffers::GetRoot(vec->data(), vec->size());
|
||||
root.ToString(true, opts.strict_json, text);
|
||||
|
||||
Reference in New Issue
Block a user