[PATCH] promote type size of intermediate values
Ignacio Laguna applied static analysis to gather.c and found this location where the product of two large ints could overflow before being assigned to a 64 bit value. --- src/mpi/coll/gather.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mpi/coll/gather.c b/src/mpi/coll/gather.c index e6387d3b..5cd00f33 100644 --- a/src/mpi/coll/gather.c +++ b/src/mpi/coll/gather.c @@ -220,8 +220,8 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype, * should cover the case where the root is * rank 0. */ mpi_errno = MPIC_Recv(((char *)recvbuf + - (((rank + mask) % comm_size)*recvcount*extent)), - recvblks * recvcount, recvtype, src, + (((rank + mask) % comm_size)*(MPI_Aint)recvcount*extent)), + (MPI_Aint)recvblks * recvcount, recvtype, src, MPIR_GATHER_TAG, comm_ptr, &status, errflag); if (mpi_errno) { -- 2.1.4 --------------080606070903000508060601 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ discuss mailing list [email protected] To manage subscription options or unsubscribe: https://lists.mpich.org/mailman/listinfo/discuss --------------080606070903000508060601--
participants (1)
-
Rob Latham