import-examples/12-15-import-formats/Ip057.glb
Sources
- Pattern-mined from the glTF 2.0 GLB container spec §4.4 (chunk = uint32 chunkLength + uint32 chunkType + data) + mikedh/trimesh GLB loader (MIT — pattern only, no bytes copied).
Description
A GLB file is a 12-byte header (`glTF` magic, version, total length) followed by length-prefixed chunks: a JSON chunk then an optional BIN chunk, each introduced by its own `uint32` chunkLength. Here the JSON chunk's real payload is 456 bytes but its length prefix declares 480 — 24 bytes too many. A reader that trusts the prefix slices 480 bytes and parses them as JSON, reading 24 bytes of the following BIN chunk (its length/type header) as if they were JSON text. This is the **binary-container-framing** analogue of the semantic accessor-overrun Ip004: the defect is one layer lower, in the chunk framing that a text `.gltf` file does not have.
Reproducer recipe
a valid single-triangle glTF 2.0 (POSITION accessor + indices, one BIN chunk) assembled as a GLB, then set the JSON chunk's `uint32` length prefix to (actual JSON length + 24) so it reaches past the padded JSON into the BIN chunk header. All other bytes untouched.
Expected kernel behavior
bound every chunk-length prefix against the declared total file length and the bytes actually remaining before trusting it; reject a chunk that claims more bytes than the file provides for it, never slice/parse past the chunk's real payload into the adjacent chunk.
Notes
Cross-oracle: trimesh 4.12.2 raises `JSONDecodeError: Extra data: line 1 column 457` — it read the 24 over-declared bytes (the BIN chunk's length+type words) into the JSON string and failed to parse them — verified 2026-08-11. A stricter/native reader over-reads binary memory. trimesh does bound the *BIN* chunk length (rejects that cleanly), but not the *JSON* chunk length. Synonyms: "GLB chunk length overrun", "glTF binary chunkLength exceeds payload", "GLB JSON chunk over-read", "binary glTF framing length prefix". Provenance tier: bytes-only.
Expected validation
Provenance tier
bytes-only — defect not fully embodied in fixture bytes.
Byte assertions
contains(b'glTF')
Live oracle output
No live oracle data — run _run_corpus to populate.
Fixture content
Show fixture bytes (with defect highlighting)
1glTF à JSON{"asset":{"version":"2.0"},"scene":0,"scenes":[{"nodes":[0]}],"nodes":[{"mesh":0}],"meshes":[{"primitives":[{"attributes":{"POSITION":0},"indices":1}]}],"accessors":[{"bufferView":0,"componentType":5126,"count":3,"type":"VEC3","min":[0,0,0],"max":[1,1,0]},{"bufferView":1,"componentType":5123,"count":3,"type":"SCALAR"}],"bufferViews":[{"buffer":0,"byteOffset":0,"byteLength":36},{"buffer":0,"byteOffset":36,"byteLength":6}],"buffers":[{"byteLength":42}]} , BIN ? ?