From 34aed93b7bd6f60241e7f13c5042bab5386be78b Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Tue, 10 Sep 2024 17:33:47 +0500 Subject: [PATCH] Fix 2 segfaults creating IfcEllipseProfileDef 1) taxonomy::ellipse was missing matrix so create_shape was segfaulting either was if Position was set or was not (segfaulting on line - https://github.com/IfcOpenShell/IfcOpenShell/blob/5616367a03ea397885e93523e55788da82238742/src/ifcgeom/kernels/opencascade/loop.cpp#L92) 2) was segfaulting when there was no default matrix Removed fc->matrix assignment as matrix is already assigned to the curve. --- src/ifcgeom/mapping/IfcEllipseProfileDef.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ifcgeom/mapping/IfcEllipseProfileDef.cpp b/src/ifcgeom/mapping/IfcEllipseProfileDef.cpp index d07e3e80fb..5608b01cdf 100644 --- a/src/ifcgeom/mapping/IfcEllipseProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcEllipseProfileDef.cpp @@ -39,6 +39,9 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEllipseProfileDef* inst) { #endif if (has_position) { m4 = taxonomy::cast(map(inst->Position())); + } else { + // matrix needs to be set on elementary curves. + m4 = taxonomy::make(); } if (ry > rx) { @@ -58,9 +61,9 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEllipseProfileDef* inst) { auto el = taxonomy::make(); el->radius = rx; el->radius2 = ry; + el->matrix = m4; ed->basis = el; lp->children.push_back(ed); fc->children.push_back(lp); - fc->matrix = m4; return fc; }