Salome HOME
fix access out of array bounds in FunctionTable::findBounds()
authoreap <eap@opencascade.com>
Tue, 25 Jul 2006 08:49:59 +0000 (08:49 +0000)
committereap <eap@opencascade.com>
Tue, 25 Jul 2006 08:49:59 +0000 (08:49 +0000)
src/StdMeshers/StdMeshers_Distribution.cxx

index ca8338d038ede95ec7a49eb9c8a7c268668bf63e..4fd04bea9c63ffae833cfb0dd7aede40c9e8cd6a 100644 (file)
@@ -145,7 +145,7 @@ double FunctionTable::integral( const double a, const double b ) const
 
 bool FunctionTable::findBounds( const double x, int& x_ind_1, int& x_ind_2 ) const
 {
 
 bool FunctionTable::findBounds( const double x, int& x_ind_1, int& x_ind_2 ) const
 {
-  int n = myData.size();
+  int n = myData.size() / 2;
   if( n==0 || x<myData[0] )
   {
     x_ind_1 = x_ind_2 = 0;
   if( n==0 || x<myData[0] )
   {
     x_ind_1 = x_ind_2 = 0;