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: V7_3_1b1~199 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=659e3364ce2c6e725e9dac75feb6ec778ee1a8bc;p=tools%2Fmedcoupling.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