From: Axel R. <ro...@us...> - 2007-11-27 16:41:31
|
Update of /cvsroot/sdif/Easdif/easdif In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv29574/easdif Modified Files: sdifmatrixdata.hpp Log Message: Prevent dereferencing vectors outside the range. Index: sdifmatrixdata.hpp =================================================================== RCS file: /cvsroot/sdif/Easdif/easdif/sdifmatrixdata.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sdifmatrixdata.hpp 30 May 2005 21:43:00 -0000 1.1 --- sdifmatrixdata.hpp 27 Nov 2007 16:41:19 -0000 1.2 *************** *** 37,40 **** --- 37,43 ---- * * $Log$ + * Revision 1.2 2007/11/27 16:41:19 roebel + * Prevent dereferencing vectors outside the range. + * * Revision 1.1 2005/05/30 21:43:00 roebel * Changed all include files from .h into .hpp to prevent name clash between *************** *** 305,310 **** } ! const T* start = &m_Data[irow*m_Ncols]; ! const T* end = &m_Data[(irow+1)*m_Ncols]; while(start !=end) *out++ = static_cast<TT>(*start++); --- 308,313 ---- } ! const T* start = &m_Data[0]+irow*m_Ncols; ! const T* end = &m_Data[0]+(irow+1)*m_Ncols; while(start !=end) *out++ = static_cast<TT>(*start++); *************** *** 330,334 **** const T* start = &m_Data[icol]; ! const T* end = &m_Data[icol+m_Nrows*m_Ncols]; for(;start !=end;start += m_Ncols) *out++ = static_cast<TT>(*start); --- 333,337 ---- const T* start = &m_Data[icol]; ! const T* end = start+m_Nrows*m_Ncols; for(;start !=end;start += m_Ncols) *out++ = static_cast<TT>(*start); *************** *** 653,657 **** */ void Clear() { ! std::fill(&m_Data[0],&m_Data[m_Data.size()],T(0)); } --- 656,660 ---- */ void Clear() { ! std::fill(&m_Data[0],&m_Data[0]+m_Data.size(),T(0)); } *************** *** 829,834 **** } ! T* start = &m_Data[irow*m_Ncols]; ! T* end = &m_Data[(irow+1)*m_Ncols]; while(start !=end) *start++ = static_cast<T>(*in++) ; --- 832,837 ---- } ! T* start = &m_Data[0]+irow*m_Ncols; ! T* end = &m_Data[0]+(irow+1)*m_Ncols; while(start !=end) *start++ = static_cast<T>(*in++) ; *************** *** 854,858 **** T* start = &m_Data[icol]; ! T* end = &m_Data[icol+m_Nrows*m_Ncols]; for(;start !=end;start += m_Ncols) *start = static_cast<T>(*in++) ; --- 857,861 ---- T* start = &m_Data[icol]; ! T* end = &m_Data[icol]+m_Nrows*m_Ncols; for(;start !=end;start += m_Ncols) *start = static_cast<T>(*in++) ; |