Skip to content

Validate filamesh buffer bounds in MeshReader#9910

Open
TristanInSec wants to merge 1 commit intogoogle:mainfrom
TristanInSec:validate-filamesh-input
Open

Validate filamesh buffer bounds in MeshReader#9910
TristanInSec wants to merge 1 commit intogoogle:mainfrom
TristanInSec:validate-filamesh-input

Conversation

@TristanInSec
Copy link
Copy Markdown

Summary

  • Add a dataSize parameter to loadMeshFromBuffer to enable bounds validation
  • Validate all header fields (vertexSize, indexSize, parts, materialCount, nameLength) against the buffer boundary before advancing the parse pointer
  • Add overflow checks for compressed index and vertex buffer size calculations
  • Fix missing fd < 0 check in loadMeshFromFile
  • Update all callers (samples, iOS samples, JS bindings, tests) to pass the buffer size

Test plan

  • Existing test_filamesh tests pass (both NonInterleaved and Interleaved)
  • Samples compile and load built-in meshes correctly
  • Truncated or malformed .filamesh files return empty Mesh instead of reading past the buffer

@TristanInSec
Copy link
Copy Markdown
Author

Hi, friendly ping on this PR. Let me know if any changes are needed. Thanks!

Add a dataSize parameter to loadMeshFromBuffer and validate all
header fields against the buffer boundary before advancing the
parse pointer. Also check for multiplication overflow in the
compressed index and vertex buffer size calculations.

Update all callers to pass the buffer size.
@TristanInSec TristanInSec force-pushed the validate-filamesh-input branch from 9bc07f4 to 943f977 Compare April 30, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants