From 3a1b3f829fa212af6b14302bad09a6b100e6347c Mon Sep 17 00:00:00 2001 From: ageay Date: Fri, 15 Mar 2013 06:39:41 +0000 Subject: [PATCH] Protection against division by 0. in MEDCouplingPointSet::Rotate3DAlg --- src/MEDCoupling/MEDCouplingPointSet.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index c83a4a642..4fc496b5f 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -803,6 +803,8 @@ void MEDCouplingPointSet::Rotate3DAlg(const double *center, const double *vect, double matrix[9]; double matrixTmp[9]; double norm=sqrt(vect[0]*vect[0]+vect[1]*vect[1]+vect[2]*vect[2]); + if(norm::min()) + throw INTERP_KERNEL::Exception("MEDCouplingPointSet::Rotate3DAlg : magnitude of input vector is too close of 0. !"); std::transform(vect,vect+3,vectorNorm,std::bind2nd(std::multiplies(),1/norm)); //rotation matrix computation matrix[0]=cosa; matrix[1]=0.; matrix[2]=0.; matrix[3]=0.; matrix[4]=cosa; matrix[5]=0.; matrix[6]=0.; matrix[7]=0.; matrix[8]=cosa; -- 2.39.2