import-examples/12-15-import-formats/Ip059.gltf
Sources
- Pattern-mined from the glTF 2.0 spec §3.7.2.1 (a primitive's index values must be < the referenced attribute accessor's `count`) + mikedh/trimesh glTF loader (MIT — pattern only, no bytes copied).
Description
A glTF mesh primitive supplies a POSITION accessor with `count` 3 (three vertices) but its `indices` accessor names triangle `(0, 1, 9)` — vertex index 9 does not exist. The glTF spec requires every index value to be less than the attribute accessor count. This is the glTF/semantic-layer member of the out-of-range family already covered for OBJ (Ip001), OFF (Ip010), PLY (Ip013), and 3MF (Ip053); it is distinct from Ip004 (which over-runs a bufferView at the byte level) because here the JSON and byte layout are internally consistent — only the decoded index *value* is out of range. Critically, the observed failure mode is the opposite of Ip001's: where the OBJ loader raises immediately, the glTF loader silently keeps the out-of-bounds triangle.
Reproducer recipe
a self-contained glTF 2.0 (data-URI buffer) with a 3-vertex POSITION accessor and an `indices` accessor of 3 `UNSIGNED_SHORT` values `0, 1, 9`; the `9` exceeds the vertex count.
Expected kernel behavior
validate every index value against the referenced accessor's count at load time; reject with a diagnostic naming the offending index, or drop the face — never admit a face whose vertex reference points past the end of the vertex array into downstream geometry.
Notes
Cross-oracle: trimesh 4.12.2 loads the mesh with faces `[[0, 1, 9]]` over only 3 vertices (valid range 0..2) — the out-of-bounds face is silently retained with no diagnostic (contrast Ip001, where the OBJ loader raises IndexError on the analogous defect) — verified 2026-08-11. Synonyms: "glTF index out of range", "gltf triangle index exceeds vertex count", "primitive index past accessor count", "OOB face index glTF". Provenance tier: bytes-only.
Expected validation
Provenance tier
bytes-only — defect not fully embodied in fixture bytes.
Byte assertions
contains(b'triangle index 9 exceeds the 3-vertex POSITION accessor')
Cross-references
Live oracle output
No live oracle data — run _run_corpus to populate.
Fixture content
Show fixture bytes (with defect highlighting)
1{ 2 "asset": { 3 "version": "2.0", 4 "generator": "Ip059: triangle index 9 exceeds the 3-vertex POSITION accessor" 5 }, 6 "scene": 0, 7 "scenes": [ 8 { 9 "nodes": [ 10 0 11 ] 12 } 13 ], 14 "nodes": [ 15 { 16 "mesh": 0 17 } 18 ], 19 "meshes": [ 20 { 21 "primitives": [ 22 { 23 "attributes": { 24 "POSITION": 0 25 }, 26 "indices": 1 27 } 28 ] 29 } 30 ], 31 "accessors": [ 32 { 33 "bufferView": 0, 34 "componentType": 5126, 35 "count": 3, 36 "type": "VEC3", 37 "min": [ 38 0, 39 0, 40 0 41 ], 42 "max": [ 43 1, 44 1, 45 0 46 ] 47 }, 48 { 49 "bufferView": 1, 50 "componentType": 5123, 51 "count": 3, 52 "type": "SCALAR" 53 } 54 ], 55 "bufferViews": [ 56 { 57 "buffer": 0, 58 "byteOffset": 0, 59 "byteLength": 36 60 }, 61 { 62 "buffer": 0, 63 "byteOffset": 36, 64 "byteLength": 6 65 } 66 ], 67 "buffers": [ 68 { 69 "uri": "data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAAAAgD8AAAAAAAABAAkA", 70 "byteLength": 42 71 } 72 ] 73}