Fix OOB reads in FlexBuffers GetRoot and add parser fuzz target - #9218
Open
smoke-wolf wants to merge 1 commit into
Open
Fix OOB reads in FlexBuffers GetRoot and add parser fuzz target#9218smoke-wolf wants to merge 1 commit into
smoke-wolf wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
smoke-wolf
force-pushed
the
fix-flexbuffers-oob-reads
branch
from
September 2, 2026 08:09
d5a2ce9 to
e10b9f9
Compare
GetRoot() previously performed no bounds checking, causing out-of-bounds reads on buffers smaller than 3 bytes and when byte_width exceeded the remaining buffer. Add size and byte_width validation to return a null Reference instead of reading OOB. Also add a new fuzz target (flexbuffers_parser_fuzzer) that exercises the GetRoot/Reference accessor code paths on unverified buffers, complementing the existing flexbuffers_verifier_fuzzer which only tests VerifyBuffer.
smoke-wolf
force-pushed
the
fix-flexbuffers-oob-reads
branch
from
September 2, 2026 08:12
e10b9f9 to
cb5ff10
Compare
Author
|
Discovered by Maliq Barnard. ASAN-confirmed OOB reads in FlexBuffers GetRoot and accessor methods on unverified buffers. See attached harness for reproduction. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GetRoot()performs no bounds checking on the input buffer, causing out-of-bounds heap reads on malformed FlexBuffers. This patch adds validation and a new fuzz target covering the unverified access path.Changes
Fix (
flexbuffers.h):size < 3check toGetRoot()— prevents OOB read on buffers too small to contain the root metadatabyte_widthvalidation (must be 1-8 and fit within remaining buffer) — prevents wild pointerReferenceon invalid input instead of reading OOBFuzz target (
flexbuffers_parser_fuzzer.cc):GetRoot()andReference::As*()on raw fuzzer inputflexbuffers_verifier_fuzzer.ccwhich only testsVerifyBuffer()Bugs fixed (all ASAN-confirmed)
GetRoot()OOB read on size < 3AsString()attacker-controlled OOB read via forged size prefixVector::operator[]type-table OOB readIndirect()wild pointer via oversized backward offsetMap::Keys()wild pointer via crafted keys offsetTypedVectorOOB access via huge size prefix🤖 Generated with Claude Code