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

Steve Jackson sjackson at cae.wisc.edu
Tue May 17 16:05:10 CDT 2011


This revision seems to break non-MPI builds-- MPI_Abort and comm go undeclared.
~S

On May 17, 2011, at 11:26 , kraftche at cae.wisc.edu wrote:

> Author: kraftche
> Date: 2011-05-17 11:26:57 -0500 (Tue, 17 May 2011)
> New Revision: 4836
> 
> Modified:
>   MOAB/trunk/src/io/ReadHDF5.cpp
> Log:
> add some checks to HDF5 reader
> 
> Modified: MOAB/trunk/src/io/ReadHDF5.cpp
> ===================================================================
> --- MOAB/trunk/src/io/ReadHDF5.cpp	2011-05-17 13:25:17 UTC (rev 4835)
> +++ MOAB/trunk/src/io/ReadHDF5.cpp	2011-05-17 16:26:57 UTC (rev 4836)
> @@ -2111,7 +2111,7 @@
>                                           hid_t contents_handle, 
>                                           hid_t meta_type,
>                                           hid_t content_type,
> -                                          long /*contents_len*/,
> +                                          long contents_len,
>                                           Range& file_ids )
> {
> 
> @@ -2190,6 +2190,27 @@
>     assert(rank == 0); // if not MPI, then only one proc
> #endif
>   }
> +  
> +  // check offsets so that we don't read past end of table or
> +  // walk off end of array.
> +  long prev = -1;
> +  for (long  i = 0; i < num_sets; ++i) {
> +    if (offset_buffer[i] < prev) {
> +      std::cerr << "Invalid data in set contents offsets at position "
> +                << i << ": index " << offset_buffer[i] 
> +                << " is less than previous index " << prev << std::endl;
> +      std::cerr.flush();
> +      MPI_Abort(comm,1);
> +    }
> +    prev = offset_buffer[i];
> +  }
> +  if (offset_buffer[num_sets-1] >= contents_len) {
> +    std::cerr << "Maximum set content index " << offset_buffer[num_sets-1]
> +              << " exceeds contents table length of " << contents_len
> +              << std::endl;
> +    std::cerr.flush();
> +    MPI_Abort(comm,1);
> +  }
> 
>   // set up buffer for reading set contents 
>   long* const content_buffer = (long*)dataBuffer;
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 



More information about the moab-dev mailing list