Commit a8b9a071 authored by Rob Latham's avatar Rob Latham
Browse files

guard against null file data representation

"native", "internal", and "external32" are the only valid values for
datarep, but if a user passes null
(http://stackoverflow.com/questions/26548398/segmentation-fault-while-using-mpi-file-read-at/

)
then strcmp will segfault.
Signed-off-by: default avatarWesley Bland <wbland@anl.gov>
parent 4ce4103a
......@@ -126,12 +126,12 @@ int MPI_File_set_view(MPI_File fh, MPI_Offset disp, MPI_Datatype etype,
goto fn_exit;
}
if (strcmp(datarep, "native") &&
if ((datarep == NULL) || (strcmp(datarep, "native") &&
strcmp(datarep, "NATIVE") &&
strcmp(datarep, "external32") &&
strcmp(datarep, "EXTERNAL32") &&
strcmp(datarep, "internal") &&
strcmp(datarep, "INTERNAL"))
strcmp(datarep, "INTERNAL")) )
{
error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment