Ad003 — Negative / zero `B_SPLINE` degree or empty knot/multiplicity lists drive `malloc` size confusion

§12.11 (sub-class: malformed-numeric / heap-overflow)

crash adversarial

Sources

Description

A schema-driven binder pre-allocates from an input count without sign / upper-bound checks; `count - 1` underflows when count is zero. Common attack shape: a `B_SPLINE_CURVE_WITH_KNOTS` declared with negative degree (e.g. -1) and negative knot multiplicities, or a `B_SPLINE_SURFACE_WITH_KNOTS` declared with zero degrees and empty knot / multiplicity lists where the schema requires positives.

Reproducer recipe

aggregate whose declared count is `-1` (sign-extends to `0xFFFFFFFF`) or `0` followed by code expecting ≥1.

Expected kernel behavior

validate against schema bounds before allocation; reject with `E_AGGREGATE_BOUNDS`.

Notes

C; CWE-191 sign-confusion repeatedly cited in Spatial/ODA/Autodesk advisories. **See also**: Ad015, Ad077. **OCC behavior**: OCC accepts and loads a valid shape(1) — the transferred model is the referenced GEOMETRIC_CURVE_SET (2-vertex compound); the negative-degree/empty-knot BSPLINE records are unreferenced orphans, so removing (clean) or exaggerating (huge, degree -9999) the defect leaves shape-counts and validity unchanged. The CVE class cited targets other libraries; OCC neither crashes nor underflows here. shape(1) does not witness a kernel bug.

Expected validation

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

Byte assertions

Tier-3 assertions

Cross-references

Ad015, Ad077

Live oracle output

No live oracle data — run _run_corpus to populate.

Fixture content

Show fixture bytes (with defect highlighting)
1ISO-10303-21;
2/* Ad003: B_SPLINE_CURVE_WITH_KNOTS with negative degree (-1) and negative knot multiplicities; B_SPLINE_SURFACE_WITH_KNOTS with zero degrees and empty knot lists; GEOMETRIC_CURVE_SET IS model entity — OCC yields empty */
3HEADER;
4FILE_DESCRIPTION(('Ad003'),'2;1');
5FILE_NAME('Ad003.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=GEOMETRIC_CURVE_SET('',(#1,#2));
13#9050=PRODUCT_CONTEXT('',#9000,'mechanical');
14#9051=PRODUCT('Ad003','Ad003','',(#9050));
15#9052=PRODUCT_DEFINITION_FORMATION('','',#9051);
16#9053=PRODUCT_DEFINITION_CONTEXT('part definition',#9000,'design');
17#9054=PRODUCT_DEFINITION('','','',#9052,#9053);
18#9055=PRODUCT_DEFINITION_SHAPE('','','',#9054);
19#9056=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
20#9057=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
21#9058=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
22#9059=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.0E-7),#9056,'distance_accuracy_value','');
23#9060=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#9059))GLOBAL_UNIT_ASSIGNED_CONTEXT((#9056,#9057,#9058))REPRESENTATION_CONTEXT('','3D'));
24#9061=MANIFOLD_SURFACE_SHAPE_REPRESENTATION('',(#3),#9060);
25#9062=SHAPE_DEFINITION_REPRESENTATION(#9055,#9061);
26#9063=BSPLINE_CURVE_WITH_KNOTS('',-1,(#1,#2),.UNSPECIFIED.,.F.,.F.,(-1,-1),(0.,1.),.UNSPECIFIED.);
27#9064=BSPLINE_SURFACE_WITH_KNOTS('',0,0,((#1)),.UNSPECIFIED.,.F.,.F.,.F.,(),(),(),(),.UNSPECIFIED.);
28ENDSEC;
29END-ISO-10303-21;