step-examples/12-13-writer-pathology/Wr014.stp
Sources
- OCCT forum "instance numbers run to 10 million for 50 entities"
- bug-reporter language: "huge instance numbers", "memory blows up loading STEP"
Sender
Writers that hash entity identity to a wide integer space and use the hash as the instance number directly
Description
A file with 50 entities uses instance numbers like `#42`, `#9876543`, `#21000000`; the maximum number is many orders of magnitude larger than the entity count. Spec-conforming, but a class of receivers naïvely pre-allocates an array of size `max(#N)`, blowing up memory. Bug-reporter language: "STEP file with huge instance numbers", "out of memory loading 50-entity file", "instance #N overflow".
Reproducer recipe
a 5-entity file where the highest instance number is `#999999999`.
Expected kernel behavior
use a sparse map (hashtable) for instance lookup; never assume `#N` is a dense array index. Reject only if `#N` exceeds 32-bit signed integer range and the kernel uses int32 indices internally.
Notes
Spec does not bound `#N`; ISO 10303-21 Ed.3 §5 defines it as an unbounded positive integer.
Expected validation
occt=empty/empty gmsh=empty ifc=schema_n/a
Byte assertions
matches(rb'#\d{7,}=')matches(rb'#\d{6,}=')
Tier-3 assertions
load == "ok"
Live oracle output
No live oracle data — run _run_corpus to populate.
Fixture content
Show fixture bytes (with defect highlighting)
1ISO-10303-21; 2/* Wr014: sparse instance numbering â 5 entities but #N reaches 999999999 */ 3HEADER; 4FILE_DESCRIPTION(('Wr014 - sparse instance numbering with huge gaps'),'2;1'); 5FILE_NAME('Wr014.stp','2026-06-20T00:00:00',('auto-generated'),(''), 6 'auto-generated','',''); 7FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 3 1 1 }')); 8ENDSEC; 9DATA; 10/* Defect: only 5 entities but instance numbers are hash-derived and huge */ 11/* Naive receivers pre-allocate array[max_id] and OOM on these 5 entities */ 12#42=CARTESIAN_POINT('origin',(0.,0.,0.)); 13#9876543=DIRECTION('zdir',(0.,0.,1.)); 14#21000000=DIRECTION('xdir',(1.,0.,0.)); 15#500000001=CARTESIAN_POINT('corner',(1.,1.,0.)); 16#999999999=GEOMETRIC_CURVE_SET('sparse-ids',(#42,#500000001)); 17ENDSEC; 18END-ISO-10303-21;