[MOAB-dev] r1621 - MOAB/trunk

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Wed Feb 27 16:32:48 CST 2008


Author: kraftche
Date: 2008-02-27 16:32:48 -0600 (Wed, 27 Feb 2008)
New Revision: 1621

Modified:
   MOAB/trunk/TypeSequenceManager.cpp
Log:
fix possible allocation of handles past end of sequence

Modified: MOAB/trunk/TypeSequenceManager.cpp
===================================================================
--- MOAB/trunk/TypeSequenceManager.cpp	2008-02-27 22:32:28 UTC (rev 1620)
+++ MOAB/trunk/TypeSequenceManager.cpp	2008-02-27 22:32:48 UTC (rev 1621)
@@ -376,6 +376,14 @@
       // if we overlap a data object, we must be entirely inside of it
     return start + num_entities - 1 <= (*i)->data()->end_handle();
   }
+
+#ifndef NDEBUG
+  if (i != begin()) {
+    const_iterator j = i;
+    --j;
+    assert( (*j)->end_handle() < start );
+  }
+#endif
   
     // check if we fit in the block of free handles
   if (start + num_entities > (*i)->start_handle()) // start + num + 1 >= i->start
@@ -387,7 +395,8 @@
     if ((*i)->values_per_entity() != values_per_ent)
       return false;
       // if overlap, must be entirely contained
-    return start >= data_out->start_handle();
+    return start >= data_out->start_handle() &&
+           start + num_entities - 1 <= data_out->end_handle();
   }
   
     // check if we overlap the data for the previous sequence




More information about the moab-dev mailing list