From: ageay Date: Mon, 19 Aug 2013 10:55:11 +0000 (+0000) Subject: Protection against sigsegv using DataArrayInt::invertArrayO2N2N2O in case on invalid... X-Git-Tag: DBugPolyhIntersector~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b5040e1cb9740430ad5fc71578cf559bf96a99b9;p=modules%2Fmed.git Protection against sigsegv using DataArrayInt::invertArrayO2N2N2O in case on invalid input. --- diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index 9c2fda8fa..92777b419 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -6202,8 +6202,19 @@ DataArrayInt *DataArrayInt::invertArrayO2N2N2O(int newNbOfElem) const const int *old2New=getConstPointer(); int *pt=ret->getPointer(); for(int i=0;i!=nbOfOldNodes;i++) - if(old2New[i]!=-1) - pt[old2New[i]]=i; + { + int newp(old2New[i]); + if(newp!=-1) + { + if(newp>=0 && newpgetPointer(); for(int i=nbOfOldNodes-1;i>=0;i--) - if(old2New[i]!=-1) - pt[old2New[i]]=i; + { + int newp(old2New[i]); + if(newp!=-1) + { + if(newp>=0 && newp