From bf058ca6b0aa739c1ddfae522d1bfd0015e9c0b1 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Thu, 11 Oct 2018 14:43:32 -0500 Subject: [PATCH] common/ompio: check datatypes when setting file view return MPI_ERR_ARG if the size of the fileview is not a multiple of the size of the etype provided. Signed-off-by: Edgar Gabriel --- ompi/mca/common/ompio/common_ompio_file_view.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ompi/mca/common/ompio/common_ompio_file_view.c b/ompi/mca/common/ompio/common_ompio_file_view.c index 71ba14ba02..bf8a25345b 100644 --- a/ompi/mca/common/ompio/common_ompio_file_view.c +++ b/ompi/mca/common/ompio/common_ompio_file_view.c @@ -141,6 +141,10 @@ int mca_common_ompio_set_view (ompio_file_t *fh, // in orig_file type, No need to set args on this one. ompi_datatype_duplicate (newfiletype, &fh->f_filetype); + if ( (fh->f_view_size % fh->f_etype_size) ) { + // File view is not a multiple of the etype. + return MPI_ERR_ARG; + } if( SIMPLE_PLUS == OMPIO_MCA_GET(fh, grouping_option) ) { fh->f_cc_size = get_contiguous_chunk_size (fh, 1);