[MOAB-dev] r1620 - MOAB/trunk
kraftche at mcs.anl.gov
kraftche at mcs.anl.gov
Wed Feb 27 16:32:28 CST 2008
Author: kraftche
Date: 2008-02-27 16:32:28 -0600 (Wed, 27 Feb 2008)
New Revision: 1620
Modified:
MOAB/trunk/MBReadUtil.cpp
Log:
add some checks on the sequence returned from SequenceManager::create_*_sequence
Modified: MOAB/trunk/MBReadUtil.cpp
===================================================================
--- MOAB/trunk/MBReadUtil.cpp 2008-02-27 20:42:12 UTC (rev 1619)
+++ MOAB/trunk/MBReadUtil.cpp 2008-02-27 22:32:28 UTC (rev 1620)
@@ -60,6 +60,11 @@
if(error != MB_SUCCESS)
return error;
+ if (seq->start_handle() > actual_start_handle ||
+ seq->end_handle() < actual_start_handle ||
+ seq->end_handle() - actual_start_handle + 1 < (unsigned)num_nodes)
+ return MB_FAILURE;
+
arrays.resize(3);
error = static_cast<VertexSequence*>(seq)->get_coordinate_arrays(arrays[0], arrays[1], arrays[2]);
@@ -94,6 +99,11 @@
if (MB_SUCCESS != error)
return error;
+ if (seq->start_handle() > actual_start_handle ||
+ seq->end_handle() < actual_start_handle ||
+ seq->end_handle() - actual_start_handle + 1 < (unsigned)num_elements)
+ return MB_FAILURE;
+
// get an array for the connectivity
array = static_cast<ElementSequence*>(seq)->get_connectivity_array();
if (!array)
@@ -119,7 +129,15 @@
flags,
start_handle,
seq );
- return error;
+ if (MB_SUCCESS != error)
+ return error;
+
+ if (seq->start_handle() > start_handle ||
+ seq->end_handle() < start_handle ||
+ seq->end_handle() - start_handle + 1 < num_sets)
+ return MB_FAILURE;
+
+ return MB_SUCCESS;
}
More information about the moab-dev
mailing list