Ip053 — 3MF triangle vertex index exceeds vertex count (out-of-range reference inside the OPC container)

§12.15 import-format parser robustness (sub-class: index-out-of-range)

P2 — spec deviation (no data loss)

crash spec-violation

Sources

Description

A 3MF package is an OPC (ZIP) container whose `3D/3dmodel.model` part carries `<vertices>` and `<triangles>` XML. This mesh declares 4 vertices but the final `<triangle>` names `v3="9"`. The 3MF Core spec requires every triangle index to be less than the vertex count; unlike a flat OBJ/OFF file the index is buried two layers deep (unzip → parse XML → index the vertex array), so a loader that validates the XML but not the index range will index a NumPy/array vertex table out of bounds. This is the container-format sibling of the flat out-of-range traps Ip001 (OBJ) and Ip010 (OFF).

Reproducer recipe

an OPC/ZIP package with the three standard parts (`[Content_Types].xml`, `_rels/.rels`, `3D/3dmodel.model`), the model part declaring exactly 4 `<vertex>` elements and 4 `<triangle>` elements where the last is `<triangle v1="1" v2="2" v3="9"/>` (index 9 exceeds the 0..3 range). Packed STORED (uncompressed) with fixed 1980-01-01 entry timestamps so the malformed XML is literally present in the bytes and the archive is byte-reproducible.

Expected kernel behavior

range-check every triangle index against the vertex count before indexing the vertex array; reject with a diagnostic naming the offending triangle and index, never let an untrusted index drive an unchecked array access.

Notes

Cross-oracle: trimesh 4.12.2 (+networkx/lxml) raises an uncaught `IndexError: index 9 is out of bounds for axis 0 with size 4` — a bare low-level crash rather than a clean "invalid 3MF" rejection — verified 2026-08-11. Synonyms: "3MF triangle index out of range", "3mf vertex index exceeds count", "OPC mesh OOB triangle", "index-past-end 3MF triangle". Provenance tier: bytes-only.

Expected validation

Provenance tier

bytes-only — defect not fully embodied in fixture bytes.

Byte assertions

Live oracle output

No live oracle data — run _run_corpus to populate.

Fixture content

Show fixture bytes (with defect highlighting)
1PK!=U!BB[Content_Types].xml<?xml version="1.0" encoding="UTF-8"?>
2<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
3<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
4<Default Extension="model" ContentType="application/vnd.ms-package.3dmanufacturing-3dmodel+xml"/>
5</Types>
6PK!\LH#_rels/.rels<?xml version="1.0" encoding="UTF-8"?>
7<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
8<Relationship Target="/3D/3dmodel.model" Id="rel0" Type="http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel"/>
9</Relationships>
10PK!M|~443D/3dmodel.model<?xml version="1.0" encoding="UTF-8"?>
11<model unit="millimeter" xml:lang="en-US" xmlns="http://schemas.microsoft.com/3dmanufacturing/core/2015/02">
12<resources>
13<object id="1" type="model">
14<mesh>
15<vertices>
16<vertex x="0" y="0" z="0"/>
17<vertex x="1" y="0" z="0"/>
18<vertex x="0" y="1" z="0"/>
19<vertex x="0" y="0" z="1"/>
20</vertices>
21<triangles>
22<triangle v1="0" v2="1" v3="2"/>
23<triangle v1="0" v2="1" v3="3"/>
24<triangle v1="0" v2="2" v3="3"/>
25<triangle v1="1" v2="2" v3="9"/>
26</triangles>
27</mesh>
28</object>
29</resources>
30<build><item objectid="1"/></build>
31</model>
32PK!=U!BB€[Content_Types].xmlPK!\LH#€s_rels/.relsPK!M|~44€¢3D/3dmodel.modelPK¸