Pf012 — Stack overflow via deeply nested aggregate parens

§12.10 (sub-class: dependency-depth)

performance

Sources

Description

Recursive-descent parser for Part-21 LIST/SET/BAG aggregates without depth ceiling crashes when an attacker supplies thousands of nested parentheses inside a single attribute.

Reproducer recipe

`#1=FOO(((((…10 000 levels…)))));`

Expected kernel behavior

Reject with E_DEPTH_EXCEEDED diagnostic: enforce a depth ceiling (e.g. 64) and emit a structured error. Must not crash via stack overflow.

Notes

**See also**: Pf008, Ad002. Provenance tier: runtime-only (Q5 reclassification 2026-07-01).

Expected validation

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

Provenance tier

runtime-only — defect not fully embodied in fixture bytes.

Byte assertions

Tier-3 assertions

Cross-references

Pf008, Ad002

Live oracle output

No live oracle data — run _run_corpus to populate.

Fixture content

Show fixture bytes (with defect highlighting)
1ISO-10303-21;
2/* Pf012: GEOMETRIC_SET with deeply nested aggregate parens (25–30 levels deep) inside a single attribute; recursive-descent parser without depth ceiling crashes via stack overflow; compliant readers must enforce a depth ceiling (e.g. 64) and emit E_AGGREGATE_TOO_DEEP; GEOMETRIC_CURVE_SET IS model entity — OCC yields reject */
3HEADER;
4FILE_DESCRIPTION(('Pf012'),'2;1');
5FILE_NAME('Pf012.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=CARTESIAN_POINT('',(1.0,0.0,0.0));
12#3=CARTESIAN_POINT('',(2.0,0.0,0.0));
13#4=CARTESIAN_POINT('',(3.0,0.0,0.0));
14#5=GEOMETRIC_CURVE_SET('',(#1));
15#9050=PRODUCT_CONTEXT('',#9000,'mechanical');
16#9051=PRODUCT('Pf012','Pf012','',(#9050));
17#9052=PRODUCT_DEFINITION_FORMATION('','',#9051);
18#9053=PRODUCT_DEFINITION_CONTEXT('part definition',#9000,'design');
19#9054=PRODUCT_DEFINITION('','','',#9052,#9053);
20#9055=PRODUCT_DEFINITION_SHAPE('','','',#9054);
21#9056=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
22#9057=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
23#9058=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
24#9059=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.0E-7),#9056,'distance_accuracy_value','');
25#9060=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#9059))GLOBAL_UNIT_ASSIGNED_CONTEXT((#9056,#9057,#9058))REPRESENTATION_CONTEXT('','3D'));
26#9061=MANIFOLD_SURFACE_SHAPE_REPRESENTATION('',(#5),#9060);
27#9062=SHAPE_DEFINITION_REPRESENTATION(#9055,#9061);
28/* depth 25 */
29#10=GEOMETRIC_SET('deep-25',
30((((((((((((((((((((((((( #1 ))))))))))))))))))))))))));
31/* Pf012-B variant: nested LIST inside a single attribute's value
32   (some readers special-case nested LISTs at any depth). */
33/* depth 22 */
34#20=GEOMETRIC_SET('deep-22',
35(((((((((((((((((((((( #1 )))))))))))))))))))))));
36/* Pf012-C variant: doubly-nested chains in one file - some healers
37   recover after the first then crash on the second. */
38/* depth 27 */
39#30=GEOMETRIC_SET('deep-27',
40((((((((((((((((((((((((((( #1 ))))))))))))))))))))))))))));
41/* depth 30 - exceeds many default ceilings */
42#40=GEOMETRIC_SET('deep-30',
43(((((((((((((((((((((((((((((( #1 )))))))))))))))))))))))))))))));
44
45ENDSEC;
46END-ISO-10303-21;