Avoid potential divide by zero in footprint spreading PVS V609

(cherry picked from commit 8588bea4b2)
This commit is contained in:
Marek Roszko 2022-02-05 11:23:05 -05:00 committed by Mark Roszko
parent b2c99dd953
commit be958e3fdb
1 changed files with 2 additions and 2 deletions

View File

@ -297,12 +297,12 @@ void SpreadFootprints( std::vector<FOOTPRINT*>* aFootprints, wxPoint aSpreadArea
{
int Xsize_allowed = (int) ( sqrt( placementsurface ) * 4.0 / 3.0 );
if( Xsize_allowed < 0 || Xsize_allowed > INT_MAX/2 )
if( Xsize_allowed <= 0 || Xsize_allowed > INT_MAX/2 )
Xsize_allowed = INT_MAX/2;
int Ysize_allowed = (int) ( placementsurface / Xsize_allowed );
if( Ysize_allowed < 0 || Ysize_allowed > INT_MAX/2 )
if( Ysize_allowed <= 0 || Ysize_allowed > INT_MAX/2 )
Ysize_allowed = INT_MAX/2;
CRectPlacement placementArea;