P027 — Boolean-history Faces with degenerate hole-loop pcurves crash writer

§12.2 pcurve

P1 — silent data loss

crash assembly

Sources

Sender

FreeCAD-internal shape graph

Description

With "write parametric pcurves" enabled, certain BSpline-surface faces with a hole loop whose pcurve domain is degenerate (zero length) or maps outside the surface's natural domain cause the STEP writer's face-emission pass to dereference null and crash. When such files are nonetheless emitted, they contain malformed pcurves on read.

Reproducer recipe

face on a BSpline surface with a hole loop whose pcurve domain is degenerate or extends outside the surface's natural domain.

Expected kernel behavior

Detect and skip / fix the bad pcurve before writing; reader should reject malformed pcurves with clear message.

Notes

Synonyms: "Boolean-history face with degenerate hole-loop pcurve crashes writer", "writer dies on degenerate inner-loop pcurve", "STEP write crash from boolean leftover".

Expected validation

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

Byte assertions

Tier-3 assertions

Live oracle output

No live oracle data — run _run_corpus to populate.

Fixture content

Show fixture bytes (with defect highlighting)
1ISO-10303-21;
2/* P027: BSpline-surface face with a hole loop whose PCURVE domain is degenerate (zero length: start == end at parameter 0.0); hole-loop pcurve maps outside the surface's natural domain; STEP writer dereferences null on face-emission pass and crashes; reader must reject malformed pcurves with clear message; B_SPLINE_SURFACE + PCURVE + SURFACE_CURVE are the defect entities. The degenerate hole-loop pcurve sits unreachable from the shape-rep root, so OCC loads a 1-vertex stub (shape(1)); and even when the pcurve is wired into a real ADVANCED_FACE hole loop, OCC recomputes every pcurve from the 3D curve during transfer (per Gp193), so the zero-length pcurve domain is absorbed and the face rebuilds byte-identically to a valid-pcurve control — the defect is oracle-invisible (shape_counts), not a load-time demonstration */
3HEADER;
4FILE_DESCRIPTION(('P027'),'2;1');
5FILE_NAME('P027.stp','2026-06-17T00:00:00',(''),(''),'cad-research-suite','','');
6FILE_SCHEMA(('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF { 1 0 10303 442 1 1 4 }'));
7ENDSEC;
8DATA;
9#9000=APPLICATION_CONTEXT('mechanical design');
10#1=CARTESIAN_POINT('',(0.0,0.0,0.0));
11#2=GEOMETRIC_CURVE_SET('',(#1));
12#9050=PRODUCT_CONTEXT('',#9000,'mechanical');
13#9051=PRODUCT('P027','P027','',(#9050));
14#9052=PRODUCT_DEFINITION_FORMATION('','',#9051);
15#9053=PRODUCT_DEFINITION_CONTEXT('part definition',#9000,'design');
16#9054=PRODUCT_DEFINITION('','','',#9052,#9053);
17#9055=PRODUCT_DEFINITION_SHAPE('','','',#9054);
18#9056=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
19#9057=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
20#9058=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
21#9059=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.0E-7),#9056,'distance_accuracy_value','');
22#9060=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#9059))GLOBAL_UNIT_ASSIGNED_CONTEXT((#9056,#9057,#9058))REPRESENTATION_CONTEXT('','3D'));
23#9061=MANIFOLD_SURFACE_SHAPE_REPRESENTATION('',(#2),#9060);
24#9062=SHAPE_DEFINITION_REPRESENTATION(#9055,#9061);
25#9063=CARTESIAN_POINT('cp00',(0.0,0.0,0.0));
26#9064=CARTESIAN_POINT('cp01',(0.0,1.0,0.0));
27#9065=CARTESIAN_POINT('cp10',(1.0,0.0,0.0));
28#9066=CARTESIAN_POINT('cp11',(1.0,1.0,0.0));
29#9067=B_SPLINE_SURFACE_WITH_KNOTS('bspline_patch',1,1,((#9063,#9064),(#9065,#9066)),.UNSPECIFIED.,.F.,.F.,.F.,(2,2),(2,2),(0.0,1.0),(0.0,1.0),.UNSPECIFIED.);
30#9068=CARTESIAN_POINT('e3d_start',(0.0,0.0,0.0));
31#9069=CARTESIAN_POINT('e3d_end',(1.0,0.0,0.0));
32#9070=DIRECTION('e3d_dir',(1.0,0.0,0.0));
33#9071=VECTOR('e3d_vec',#9070,1.0);
34#9072=LINE('edge_line_3d',#9068,#9071);
35#9073=CARTESIAN_POINT('deg_pcurve_pt',(0.0,0.0));
36#9074=DIRECTION('deg_pcurve_dir',(1.0,0.0));
37#9075=VECTOR('deg_pcurve_vec',#9074,0.0);
38#9076=LINE('deg_pcurve_line',#9073,#9075);
39#9077=DEFINITIONAL_REPRESENTATION('',(#9076),#9060);
40#9078=PCURVE('degenerate_hole_pcurve',#9067,#9077);
41#9079=SURFACE_CURVE('defect_surface_curve',#9072,(#9078),.PCURVE_S1.);
42#9080=GEOMETRIC_CURVE_SET('degenerate_pcurve_defect',(#9079));
43#9081=PRODUCT_CONTEXT('sub',#9000,'mechanical');
44#9082=PRODUCT('BoolHistoryFace','BoolHistoryFace','',(#9081));
45#9083=PRODUCT_DEFINITION_FORMATION('','',#9082);
46#9084=PRODUCT_DEFINITION('design','',#9083,#9053);
47#9085=NEXT_ASSEMBLY_USAGE_OCCURRENCE('1','bool_history_face_instance','',#9054,#9084,$);
48ENDSEC;
49END-ISO-10303-21;