step-examples/12-1b-header/Lh022.stp
Sources
- 07-stepcode-ifcopenshell T015, 12-adversarial A006, 16-iso-spec N034
Description
Within one DATA section each `#N` may appear on the LHS at most once. Concatenating two STEP files with overlapping IDs, or merging sub-files without renumbering, produces duplicates. Silent overwrite causes semantic divergence; in C++ implementations, freeing the first instance while references still point at it transitions to use-after-free.
Reproducer recipe
`DATA; #10=PRODUCT('a','a','',(#11)); #10=PRODUCT('b','b','',(#12)); ENDSEC;` or `#19=IFCPROJECT(..); #19=IFCSITE(..);`
Expected kernel behavior
reject with `E_DUPLICATE_INSTANCE_ID` before constructing the second instance; never silently overwrite or free-then-reuse.
Notes
**See also**: Ad038, Lh024. **OCC behavior**: silently accepts duplicate instance IDs (typically last-write-wins) without diagnostic; kernel mishandling; the catalog above forbids silent overwrite. Synonyms: "duplicate instance ID in DATA", "#42 defined twice in STEP", "concatenated STEP files have ID collision", "two definitions of same #N", "instance ID overwrites previous".
Expected validation
occt=empty/empty gmsh=empty ifc=schema_n/a
Byte assertions
count_entity_def(b'PRODUCT') >= 2 or matches(rb'(?s)#4=PRODUCT.*#4=PRODUCT')matches(rb'(?s)#4=PRODUCT.*#4=PRODUCT')
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/* Lh022: duplicate instance ID â #4=PRODUCT defined twice in one DATA section */ 3/* DEFECT: ISO 10303-21 requires each #N to appear at most once as LHS in DATA */ 4/* Produced by concatenating two STEP files without renumbering IDs */ 5/* OCC: silently accepts (last-write-wins); catalog forbids silent overwrite */ 6HEADER; 7FILE_DESCRIPTION(('Lh022: duplicate instance ID #4 defined twice in DATA'),'2;1'); 8FILE_NAME('Lh022.stp','2026-06-20T00:00:00',(''),(''),'cad-research-suite','',''); 9FILE_SCHEMA(('AUTOMOTIVE_DESIGN')); 10ENDSEC; 11DATA; 12#1=CARTESIAN_POINT('origin',(0.,0.,0.)); 13#2=CARTESIAN_POINT('corner',(1.,1.,0.)); 14#3=PRODUCT_DEFINITION_CONTEXT('part definition',#5,'design'); 15/* DEFECT: first definition of #4 */ 16#4=PRODUCT('widget-a','Widget A','',(#3)); 17#5=APPLICATION_CONTEXT('automotive design'); 18/* DEFECT: second definition of #4 â same ID reused, violates ISO 10303-21 */ 19#4=PRODUCT('widget-b','Widget B','',(#3)); 20#6=GEOMETRIC_CURVE_SET('duplicate-id-shape',(#1,#2)); 21ENDSEC; 22END-ISO-10303-21;