You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FlexBuffers: reject cyclic buffers in the C++ Verifier
The FlexBuffers verifier accepted cyclic buffers when a reuse_tracker was
supplied. Because offsets point backwards, a vector/map element can reference
an ancestor node that is still being verified; the reuse tracker's
de-duplication treated that re-visit as "already verified" and returned true,
so verification passed. Recursive accessors (Reference::ToString() and any
user traversal) then followed the cycle with no depth/cycle guard, recursing
until the stack was exhausted (DoS). Without a reuse_tracker the depth limit
already rejected these buffers; the tracker's early return is what bypassed it.
Make the reuse tracking cycle-aware in VerifyVector: mark a node in-progress
while its children are verified and mark it verified on completion. A re-visit
of an in-progress node is a cycle (reject); a re-visit of a completed node with
the same type is a legitimate shared/DAG reference (skip, as before). This
preserves DAG de-duplication of shared keys/strings and keeps verification
linear.
Also add a regression test (FlexBuffersCyclicBufferTest) and extend
flexbuffers_verifier_fuzzer to access the buffer after a successful verify, so
the "verified => safe to access" property is fuzzed going forward.
0 commit comments