From 8c984359ddef000f52b51ad70cd395f1a36629ee Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 11 May 2022 10:03:53 +0200 Subject: [PATCH] Part: LGTM: Multiplication result may overflow 'int' before it is converted to 'unsigned int'. --- src/Mod/Part/App/Geometry.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Mod/Part/App/Geometry.cpp b/src/Mod/Part/App/Geometry.cpp index 3ad008d1f2..ae5ca04031 100644 --- a/src/Mod/Part/App/Geometry.cpp +++ b/src/Mod/Part/App/Geometry.cpp @@ -4369,8 +4369,10 @@ unsigned int GeomBezierSurface::getMemSize (void) const { unsigned int size = sizeof(Geom_BezierSurface); if (!mySurface.IsNull()) { - size += mySurface->NbUPoles() * mySurface->NbVPoles() * sizeof(gp_Pnt); - size += mySurface->NbUPoles() * mySurface->NbVPoles() * sizeof(Standard_Real); + unsigned int poles = mySurface->NbUPoles(); + poles *= mySurface->NbVPoles(); + size += poles * sizeof(gp_Pnt); + size += poles * sizeof(Standard_Real); } return size; } @@ -4448,8 +4450,10 @@ unsigned int GeomBSplineSurface::getMemSize (void) const size += mySurface->NbUKnots() * sizeof(Standard_Integer); size += mySurface->NbVKnots() * sizeof(Standard_Real); size += mySurface->NbVKnots() * sizeof(Standard_Integer); - size += mySurface->NbUPoles() * mySurface->NbVPoles() * sizeof(gp_Pnt); - size += mySurface->NbUPoles() * mySurface->NbVPoles() * sizeof(Standard_Real); + unsigned int poles = mySurface->NbUPoles(); + poles *= mySurface->NbVPoles(); + size += poles * sizeof(gp_Pnt); + size += poles * sizeof(Standard_Real); } return size; }