Pf037 — Two-pass loader: dangling forward-ref subgraph silently truncated (BRL-CAD step-g)

§12.10 scale & performance (sub-class: silent partial subgraph elision)

P2 — spec deviation (no data loss)

performance

Sources

Sender

Large-assembly STEP files where one entity record is structurally well-formed (so pass-1 instantiates a stub object) but references a downstream entity that itself failed to instantiate (e.g. a malformed complex-entity record). Common in fuzzed inputs and in CAD-system exports that emit forward references the writer never validated.

Description

BRL-CAD step-g uses a two-pass loader: pass-1 walks the DATA section and instantiates one C++ object per STEP entity, registering each via id; pass-2 walks the list again, calling `Load()` on each object, which dereferences forward references through the id→object map. When a referenced id was never created in pass-1 (or has `entity_status = STEP_LOAD_ERROR`), pass-2 marks the *referencing* entity also as `STEP_LOAD_ERROR` and emits a single `WARNING: <name> is not valid` to `bu_log`. But the upstream caller does **not** check `entity_status` for the shells/solids it consumes; the shape-definition path completes with whatever fragments it managed to build, and the resulting .g file lacks the entire subgraph that depended on the broken reference. On large assemblies the user only notices the truncation after a multi-minute import; the diagnostic stream is too noisy to spot the specific WARNING line.

Reproducer recipe

STEP file containing a topology entity that references id `#999` which is never defined. Pass-1 instantiates the entity; pass-2 sets `STEP_LOAD_ERROR`; the parent shape is silently truncated.

Expected kernel behavior

reject; every shell/solid consumer in `LoadONBrep` must consult `entity_status` of every dereferenced child and bubble up `STEP_LOAD_ERROR`; the top-level converter must abort with a non-zero exit code rather than write a partial .g file.

Notes

**See also**: Wr013, Ad005, Pf003. Synonyms: "BRL-CAD step-g silent partial subgraph elision", "STEP_LOAD_ERROR not propagated to caller", "WARNING is not valid hidden in noise", "two-pass loader truncates on dangling forward ref", "step-g writes partial .g without exit code".

Expected validation

occt=shape(1)/shape(1) gmsh=shape(3) ifc=schema_n/a

Byte assertions

Tier-3 assertions

Cross-references

Wr013, Ad005, Pf003

Live oracle output

No live oracle data — run _run_corpus to populate.

Fixture content

Show fixture bytes (with defect highlighting)
1ISO-10303-21;
2/* Pf037: EDGE_CURVE with dangling #999 forward reference (silent truncation) */
3HEADER;
4FILE_DESCRIPTION(('Pf037'),'2;1');
5FILE_NAME('Pf037.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=CARTESIAN_POINT('',(0.0,0.0,0.0));
16#7=CARTESIAN_POINT('',(1.0,0.0,0.0));
17#8=VERTEX_POINT('',#6);
18#9=VERTEX_POINT('',#7);
19#10=DIRECTION('',(1.0,0.0,0.0));
20#11=VECTOR('',#10,1.0);
21#12=LINE('',#6,#11);
22#13=EDGE_CURVE('',#8,#9,#12,.T.);
23#14=ORIENTED_EDGE('',$,$,#13,.T.);
24#15=EDGE_LOOP('',(#14));
25#16=FACE_OUTER_BOUND('',#15,.T.);
26#17=ADVANCED_FACE('',(#16),#5,.T.);
27#18=OPEN_SHELL('',(#17));
28#19=SHELL_BASED_SURFACE_MODEL('',(#18));
29#9050=PRODUCT_CONTEXT('',#9000,'mechanical');
30#9051=PRODUCT('Pf037','Pf037','',(#9050));
31#9052=PRODUCT_DEFINITION_FORMATION('','',#9051);
32#9053=PRODUCT_DEFINITION_CONTEXT('part definition',#9000,'design');
33#9054=PRODUCT_DEFINITION('','','',#9052,#9053);
34#9055=PRODUCT_DEFINITION_SHAPE('','','',#9054);
35#9056=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
36#9057=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
37#9058=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
38#9059=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.0E-7),#9056,'distance_accuracy_value','');
39#9060=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#9059))GLOBAL_UNIT_ASSIGNED_CONTEXT((#9056,#9057,#9058))REPRESENTATION_CONTEXT('','3D'));
40#9061=MANIFOLD_SURFACE_SHAPE_REPRESENTATION('',(#19),#9060);
41#9062=SHAPE_DEFINITION_REPRESENTATION(#9055,#9061);
42#9063=EDGE_CURVE('dangling_subgraph',#10,#11,#999,.T.);
43ENDSEC;
44END-ISO-10303-21;