Skip to content

Validate coding_params and unpacked bounds in Mesh::CreateFromQuantizedData. - #888

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_1026456310
Nov 20, 2026
Merged

copybara-service[bot] merged 1 commit into
mainfrom
test_1026456310

Conversation

@copybara-service

Copy link
Copy Markdown

Validate coding_params and unpacked bounds in Mesh::CreateFromQuantizedData.

Mesh::CreateFromQuantizedData previously only checked coding_params.size(), without validating each attribute's MeshAttributeCodingParams or verifying that unpacked attribute bounds remain finite. On untrusted packed CodedMesh protos (via DecodeMesh), this allowed:

  • Wrong component counts in coding_params to trigger an out-of-bounds SmallArray read in ComputeAttributeBounds.
  • Non-finite offset/scale or scale <= 0 to succeed in DecodeMesh and then trip ABSL_DCHECK(IsValidCodingParams(...)) on the first FloatVertexAttribute / VertexPosition call.
  • Large finite offset/scale values whose unpacked bounds overflow float to produce non-finite vertex attributes.

Expose mesh_internal::IsValidCodingParams, validate every attribute's coding_params and decoded min/max bounds in Mesh::CreateFromQuantizedData, and strengthen DecodeMeshDoesNotCrashOnArbitraryInput to read Bounds() and all unpacked vertex attributes.

@copybara-service
copybara-service Bot force-pushed the test_1026456310 branch 3 times, most recently from ed0cfae to 732df5c Compare November 20, 2026 21:03
…edData.

`Mesh::CreateFromQuantizedData` previously only checked `coding_params.size()`, without validating each attribute's `MeshAttributeCodingParams` or verifying that unpacked attribute bounds remain finite. On untrusted packed `CodedMesh` protos (via `DecodeMesh`), this allowed:

- Wrong component counts in `coding_params` to trigger an out-of-bounds `SmallArray` read in `ComputeAttributeBounds`.
- Non-finite `offset`/`scale` or `scale <= 0` to succeed in `DecodeMesh` and then trip `ABSL_DCHECK(IsValidCodingParams(...))` on the first `FloatVertexAttribute` / `VertexPosition` call.
- Large finite `offset`/`scale` values whose unpacked bounds overflow `float` to produce non-finite vertex attributes.

Expose `mesh_internal::IsValidCodingParams`, validate every attribute's `coding_params` and decoded min/max bounds in `Mesh::CreateFromQuantizedData`, and strengthen `DecodeMeshDoesNotCrashOnArbitraryInput` to read `Bounds()` and all unpacked vertex attributes.

PiperOrigin-RevId: 1026710645
@copybara-service
copybara-service Bot merged commit d07c80a into main Nov 20, 2026
2 checks passed
@copybara-service
copybara-service Bot deleted the test_1026456310 branch November 20, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants