From: Martin Quinson Date: Sat, 17 Aug 2019 21:07:21 +0000 (+0200) Subject: PMPI_Cart_create: check that each dim is positive X-Git-Tag: v3.24~179 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5f7f104edbeb1ff7362303fd60eeb7565829733e?hp=4c973838831fbfc14675fd437af1e8b060cb8a3a PMPI_Cart_create: check that each dim is positive --- diff --git a/src/smpi/bindings/smpi_pmpi_topo.cpp b/src/smpi/bindings/smpi_pmpi_topo.cpp index 37c62ef03f..c0cd8f0d58 100644 --- a/src/smpi/bindings/smpi_pmpi_topo.cpp +++ b/src/smpi/bindings/smpi_pmpi_topo.cpp @@ -19,7 +19,11 @@ int PMPI_Cart_create(MPI_Comm comm_old, int ndims, const int* dims, const int* p return MPI_ERR_COMM; } else if (ndims < 0 || (ndims > 0 && (dims == nullptr || periodic == nullptr)) || comm_cart == nullptr) { return MPI_ERR_ARG; - } else{ + } else { + for (int i = 0; i < ndims; i++) + if (dims[i] < 0) + return MPI_ERR_ARG; + simgrid::smpi::Topo_Cart* topo = new simgrid::smpi::Topo_Cart(comm_old, ndims, dims, periodic, reorder, comm_cart); if (*comm_cart == MPI_COMM_NULL) { delete topo;