draco: heap-buffer-overflow in KHR_draco_mesh_compression parsing when bufferView byteOffset exceeds buffer size (vendored tinygltf)

Open Beginner friendly
#1,257 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 5 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp

Research direction

Read ParseDracoExtension in third_party/tinygltf/tiny_gltf.h around lines 4289–4296, then trace how it builds the buffer slice from byteOffset and byteLength. Check the bounds using the reported 520-byte buffer and byteOffset 10000 case. Done means the malformed glTF is rejected before the Draco decoder reads beyond the buffer.

Written by the indexing model from the issue text.

Description

Root cause: the vendored tinygltf parser's ParseDracoExtension (third_party/tinygltf/tiny_gltf.h, ~lines 4289-4296) builds the Draco buffer slice from a bufferView's byteOffset without validating it against the buffer's byteLength. With byteOffset=10000 on a 520-byte buffer, it constructs a slice claiming 520 bytes starting at data+10000; draco's DecoderBuffer then reads past the real buffer end. DecoderBuffer's own size check passes because it is handed the false size — the fault is in the tinygltf slice construction, the crash surfaces in draco's decoder.

Evidence (local ASan build, KHR_draco_mesh_compression glTF, 1-field JSON change from a valid seed, seed buffer untouched):

  • ASan heap-buffer-overflow READ size 5: memcpy -> DecoderBuffer::Decode (src/draco/core/decoder_buffer.h:80) -> PointCloudDecoder::DecodeHeader -> Decoder::DecodeBufferToGeometry -> Decoder::DecodeMeshFromBuffer -> ParseDracoExtension (tiny_gltf.h:4296) -> ParsePrimitive -> ParseMesh.
  • Trigger: bufferView byteOffset 10000 with buffers[0].byteLength 520.

Impact: out-of-bounds read / crash (denial of service) in any tool parsing KHR_draco_mesh_compression glTF through this path. Low severity.

Suggested fix: validate byteOffset + byteLength against the buffer size in ParseDracoExtension before building the slice, or update the vendored tinygltf copy.

Note: checked against #1165 — different code path (draco's own decoder, not the tinygltf extension slice).

Reproducer: the minimal 2.2KB glTF trigger is available on request.

Dominant language
C++
Stars
7.5k
Forks
1.1k
Avg merge
3d 11h
Merged PRs (30d)
9

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from google/draco

All issues in google/draco

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.