[MOAB-dev] r5771 - MOAB/trunk/src/io

iulian at mcs.anl.gov iulian at mcs.anl.gov
Tue Oct 9 11:23:31 CDT 2012


Author: iulian
Date: 2012-10-09 11:23:31 -0500 (Tue, 09 Oct 2012)
New Revision: 5771

Modified:
   MOAB/trunk/src/io/Tqdcfr.cpp
Log:
bug discovered by Xiabing while running on ubuntu 12.04, in optimized mode
it is an array overflow, and it seems that ubuntu 12 is more sensitive with these. 
Also, the problem appeared because of an empty block in the cub file used for testing. 
I let it there, it could uncover some more bugs :)


Modified: MOAB/trunk/src/io/Tqdcfr.cpp
===================================================================
--- MOAB/trunk/src/io/Tqdcfr.cpp	2012-10-08 12:14:12 UTC (rev 5770)
+++ MOAB/trunk/src/io/Tqdcfr.cpp	2012-10-09 16:23:31 UTC (rev 5771)
@@ -1855,7 +1855,8 @@
     if (52 != block_headers[i].blockElemType) {
       int num_verts = cub_elem_num_verts[block_headers[i].blockElemType];
       block_headers[i].blockEntityType = block_type_to_mb_type[block_headers[i].blockElemType];
-      if (num_verts != CN::VerticesPerEntity(block_headers[i].blockEntityType)) {
+      if ((block_headers[i].blockEntityType < MBMAXTYPE) &&
+         ( num_verts != CN::VerticesPerEntity(block_headers[i].blockEntityType)) ) {
           // not a linear element; try to find hasMidNodes values
         for (int j = 0; j < 4; j++) block_headers[i].hasMidNodes[j] = 0;
         if (0 == instance->hasMidNodesTag) {



More information about the moab-dev mailing list