Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent crash on incompatible profile curves #938

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions iModelCore/GeomLibs/geom/src/bspline/bspsurf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3362,14 +3362,16 @@ double closureTolerance
//--------------------------------------------------------------------------------------
// @bsimethod
//--------------------------------------------------------------------------------------
Public GEOMDLLIMPEXP int bsputil_ruledSurfaceFromCompatibleCurves
Public GEOMDLLIMPEXP int bsputil_ruledSurfaceFromCompatibleCurves
(
MSBsplineSurface *surface,
MSBsplineCurve *curve1,
MSBsplineCurve *curve1, // order, knots become surface uParams.order, uKnots
MSBsplineCurve *curve2
)
{
int i, uPoles;
// ADO#885899: inputs should be compatible, but verify the pole counts at least
if (!surface || !curve1 || !curve2 || curve1->params.numPoles != curve2->params.numPoles)
return ERROR;

/* Clear the entire structure so only the nonZero values need be set */
memset (surface, 0, sizeof(*surface));
Expand All @@ -3387,7 +3389,7 @@ MSBsplineCurve *curve2
if (bspsurf_allocateSurface (surface))
return ERROR;

for (i=0, uPoles=surface->uParams.numPoles; i < curve1->params.numPoles;
for (int i = 0, uPoles = surface->uParams.numPoles; i < curve1->params.numPoles;
i++, uPoles++)
{
surface->poles[i] = curve1->poles[i];
Expand Down
Loading