step-examples/12-3b-wires/Twi282.stp
Sources
- Pattern-mined from prusa3d/PrusaSlicer#11305 — pattern only, no bytes
- the attached `stack-overflow.step` is a user-uploaded proprietary CAD export (DESCRIBE-ONLY, never ingested). ASAN report: frames alternate `StepShape_OrientedEdge::EdgeEnd()` ⇄ `EdgeStart()` in `OCCTWrapper.so`.
Description
An `ORIENTED_EDGE` whose `edge_element` (4th arg) references ITSELF, e.g. `#N=ORIENTED_EDGE('',*,*,#N,.F.);`. The spec requires `edge_element` to be an `EDGE` (ultimately an `EDGE_CURVE`); here it is the `ORIENTED_EDGE` itself. OCCT's derived-attribute accessors `EdgeStart()`/`EdgeEnd()` delegate to `edge_element->EdgeStart()` (swapping to `EdgeEnd()` when `orientation=.F.`); a self-cycle never reaches an `EDGE_CURVE`, so the two accessors recurse into each other forever and blow the C stack — a fuzz-grade DoS.
Reproducer recipe
`#N=ORIENTED_EDGE('',*,*,#N,.F.);` placed in an `EDGE_LOOP` → `FACE_OUTER_BOUND` → `ADVANCED_FACE` (on a `PLANE`) → `OPEN_SHELL` so the edge-loop transfer pass dereferences it. A 2-cycle (`#1→#2→#1`) overflows identically.
Expected kernel behavior
chase `ORIENTED_EDGE` wrapper chains under a depth/visited-set guard; on a cycle emit `E_EDGE_CYCLE` and drop the edge (or reject the file). Must not stack-overflow — a receiver must give up gracefully on adversarial input.
Notes
**See also**: Twi004 (a FINITE wrapper chain that terminates at an `EDGE_CURVE` and is healed by traversal — silent-empty, no crash); this is the UNBOUNDED-cycle variant. **Cross-reference**: §12.11 Ad (adversarial / fuzz DoS) — distinct entity path from Gs054 (COMPOSITE_CURVE_SEGMENT self-cycle) and Ad087/Pf010 (generic entity-graph / external-ref cycle); no existing entry covers an `ORIENTED_EDGE.edge_element` cycle. The self-referential `#N` IS the intended defect (not an accidental dangling ref); the pure-Python Part-21 validator accepts the file (the id resolves — to itself). Expected-validation line is PROVISIONAL best-guess (crasher; the live oracle was not run in this worktree). Synonyms: "ORIENTED_EDGE points at itself", "cyclic edge_element self-reference", "EdgeStart/EdgeEnd infinite recursion", "self-referential oriented edge stack overflow", "unbounded wrapper-chain recursion in edge topology". Provenance tier: bytes-sufficient.
Expected validation
occt=signal(11)/signal(11) gmsh=signal(11) ifc=schema_n/a
Byte assertions
contains(b'ORIENTED_EDGE')count_entity_def(b'ORIENTED_EDGE') == 1matches(rb"#(\d+)=ORIENTED_EDGE\('',\*,\*,#\1,\.F\.\)")
Cross-references
Live oracle output
No live oracle data — run _run_corpus to populate.
Fixture content
Show fixture bytes (with defect highlighting)
1ISO-10303-21; 2/* Twi282: OPEN_SHELL with one ADVANCED_FACE on a PLANE (z=0, normal +Z); FACE_OUTER_BOUND references an EDGE_LOOP whose single ORIENTED_EDGE has its edge_element (4th arg) pointing at ITSELF â a cyclic self-reference with no EDGE_CURVE anywhere in the cycle; the derived EdgeStart()/EdgeEnd() accessors recurse into each other unbounded and overflow the stack; receiver must guard wrapper-chain traversal with a visited-set/depth bound and never crash */ 3HEADER; 4FILE_DESCRIPTION(('Twi282'),'2;1'); 5FILE_NAME('Twi282.stp','2026-06-17T00:00:00',(''),(''),'cad-research-suite','',''); 6FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 3 1 1 }')); 7ENDSEC; 8DATA; 9#9000=APPLICATION_CONTEXT('mechanical design'); 10#1=CARTESIAN_POINT('',(0.0,0.0,0.0)); 11#2=DIRECTION('',(0.0,0.0,1.0)); 12#3=DIRECTION('',(1.0,0.0,0.0)); 13#4=AXIS2_PLACEMENT_3D('',#1,#2,#3); 14#5=PLANE('',#4); 15#6=ORIENTED_EDGE('',*,*,#6,.F.); 16#7=EDGE_LOOP('',(#6)); 17#8=FACE_OUTER_BOUND('',#7,.T.); 18#9=ADVANCED_FACE('',(#8),#5,.T.); 19#10=OPEN_SHELL('',(#9)); 20#11=SHELL_BASED_SURFACE_MODEL('',(#10)); 21#9050=PRODUCT_CONTEXT('',#9000,'mechanical'); 22#9051=PRODUCT('Twi282','Twi282','',(#9050)); 23#9052=PRODUCT_DEFINITION_FORMATION('','',#9051); 24#9053=PRODUCT_DEFINITION_CONTEXT('part definition',#9000,'design'); 25#9054=PRODUCT_DEFINITION('','','',#9052,#9053); 26#9055=PRODUCT_DEFINITION_SHAPE('','','',#9054); 27#9056=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.)); 28#9057=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.)); 29#9058=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT()); 30#9059=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.0E-7),#9056,'distance_accuracy_value',''); 31#9060=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#9059))GLOBAL_UNIT_ASSIGNED_CONTEXT((#9056,#9057,#9058))REPRESENTATION_CONTEXT('','3D')); 32#9061=MANIFOLD_SURFACE_SHAPE_REPRESENTATION('',(#11),#9060); 33#9062=SHAPE_DEFINITION_REPRESENTATION(#9055,#9061); 34ENDSEC; 35END-ISO-10303-21;