step-examples/12-11-adversarial/Ad004.stp
Sources
- 12-adversarial.md A004
- 08-occt-gitlog.md G031 (`StepData_EntityCluster` recursion), G032 (self-referencing external file), G033 (reference-to-reference SRR)
- IfcOpenShell issues 2081, 7110, 7303
Description
Complex entity `#A=(B(..) C(#A))` references itself, or longer cycle `#A→#B→…→#A`. Resolver recurses until stack exhausted. Variant: `APPLIED_EXTERNAL_IDENTIFICATION_ASSIGNMENT` whose target path resolves to the very file being read.
Reproducer recipe
`#1=(NAMED_UNIT(*) DERIVED_UNIT_ELEMENT(#1, 1.0));` or external-file reference whose canonical path equals the input file.
Expected kernel behavior
Reject with diagnostic via tarjan-style cycle detection; iterative graph traversal; canonical-path check before opening external refs. Must not infinite loop.
Notes
H DoS; XML billion-laughs analogue. **See also**: Ad026, Ad052, Ad053, Ad085.
Expected validation
occt=empty/empty gmsh=empty ifc=schema_n/a
Byte assertions
matches(rb'(?s)#\d+=\([A-Z_]+\([^)]*\)[^;]+#\d+[^;]+\);.*REPRESENTATION_RELATIONSHIP')matches(rb'#\d+=\(')
Tier-3 assertions
load == "ok"
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/* Ad004: cyclic complex-entity reference graph; self-cycle in complex entity; two-node cycle; cycle via REPRESENTATION_RELATIONSHIP; GEOMETRIC_CURVE_SET IS model entity â OCC yields empty */ 3HEADER; 4FILE_DESCRIPTION(('Ad004'),'2;1'); 5FILE_NAME('Ad004.stp','2026-06-17T00:00:00',(''),(''),'cad-research-suite','',''); 6FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 3 1 1 }')); 7ENDSEC; 8DATA; 9#1=CARTESIAN_POINT('',(0.0,0.0,0.0)); 10#2=GEOMETRIC_CURVE_SET('',(#1)); 11#3=(NAMED_UNIT(*) DERIVED_UNIT_ELEMENT(#3, 1.0)); 12#4=GROUP_ASSIGNMENT(#5); 13#5=GROUP_ASSIGNMENT(#4); 14#6=AXIS2_PLACEMENT_3D('',#1,$,$); 15#7=SHAPE_REPRESENTATION('a',(#1),#6); 16#8=SHAPE_REPRESENTATION('b',(#1),#6); 17#9=REPRESENTATION_RELATIONSHIP('forward','',#7,#8); 18#10=REPRESENTATION_RELATIONSHIP('back','',#8,#7); 19ENDSEC; 20END-ISO-10303-21;