[MPICH] length of array passed to MPI_Type_set_name

Rajeev Thakur thakur at mcs.anl.gov
Fri Jul 13 12:20:58 CDT 2007


> In mpich2-1.0.5p4/test/mpi/util/mtest.c on line 612, 
> MPI_Type_set_name 
> is called with a name for which the storage is shorter than 
> MPI_MAX_OBJECT_NAME.

It is ok to call set_name with storage less than that, but not get_name if
you don't already know the size of the name.
 
> It is unclear to me though if MPI-2 does not require the 
> array to be (at 
> least) MPI_MAX_OBJECT_NAME characters long (including the 
> null-terminator). For instance, the 2nd 'advice to users' on 
> page 175 of 
> MPI-2 says '... not a guarantee that setting names of less than this 
> length will always succeed'.

The sentence begins with "Under circumstances of store exhaustion" 

 
> Although I admit to find the paragraph I quoted above a bit 
> confusing, I 
> can imagine though that an MPI implementation might 
> memcpy(internal_store,name_given_by_user,MPI_MAX_OBJECT_NAME). If in 
> that case, 'name_given_by_user' is not MPI_MAX_OBJECT_NAME characters 
> long, the memcpy might trigger a segmentation fault.

It should do a strcpy.

Rajeev




More information about the mpich-discuss mailing list