Fix heap-buffer-overflow read in binary PLY list property parsing - #1213
Open
ganiganesh25 wants to merge 1 commit into
Open
Fix heap-buffer-overflow read in binary PLY list property parsing#1213ganiganesh25 wants to merge 1 commit into
ganiganesh25 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. |
PlyReader::ParseElementData() read an attacker-controlled list count from a "property list" field and used it to compute the number of bytes to copy out of the input DecoderBuffer, without checking that the buffer had that many bytes remaining. The copy went through buffer->data_head() directly rather than a bounds-checked Decode()/Peek() call, so a crafted binary PLY with a large list count followed by truncated data causes an out-of-bounds heap read. Reachable via the public draco::ReadPointCloudFromFile / ReadMeshFromFile API on untrusted binary_little_endian PLY input. Add bounds checks before the list and non-list property copies, and check the return value of the list-count Decode() call. Add a regression test with a truncated list property.
ganiganesh25
force-pushed
the
fix/ply-reader-oob-read
branch
from
August 2, 2026 18:17
8607acc to
1edbde0
Compare
Author
|
@googlebot I signed it! |
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
PlyReader::ParseElementData()(insrc/draco/io/ply_reader.cc) reads an attacker-controlled list count from aproperty listfield in a binary PLY file, and uses it to compute the number of bytes to copy out of the inputDecoderBuffer, without checking that the buffer actually has that many bytes remaining.buffer->data_head()directly (raw pointer +std::vector::insert) instead of a bounds-checkedDecode()/Peek()call, and the return value of the one bounds-checkedDecode()call in that path was also being discarded.binary_little_endianPLY file with a large list count followed by truncated data therefore causes an out-of-bounds heap read.draco::ReadPointCloudFromFile/ReadMeshFromFileAPI when loading untrusted.plyfiles.Fix
Decode()call.num_bytes_to_readagainstbuffer->remaining_size()before copying list property data.PlyReaderTest.TestReaderTruncatedListData) with a truncated list property that previously triggered the overflow.Verification
Reproduced locally with a small standalone driver linking
libdracobuilt with-fsanitize=address, feeding it a crafted PLY:With the fix applied, the same input is rejected cleanly (
Couldn't parse properties) instead of crashing.Test plan
PlyReaderTest.TestReaderTruncatedListDatapasses.draco_testssuite (186 tests) passes under AddressSanitizer, no regressions.testdata/*.plyfixtures (ASCII and binary) still decode correctly with the patched reader.