Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
please herr sonar
authorAugustin Degomme <adegomme@users.noreply.github.com>
Sat, 6 Apr 2019 12:54:02 +0000 (14:54 +0200)
committerAugustin Degomme <adegomme@users.noreply.github.com>
Sat, 6 Apr 2019 12:54:35 +0000 (14:54 +0200)
src/smpi/bindings/smpi_pmpi_coll.cpp

index c4f8183..2eb62c2 100644 (file)
@@ -760,7 +760,9 @@ int PMPI_Ialltoall(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* re
     MPI_Datatype sendtmptype = sendtype;
     if (sendbuf == MPI_IN_PLACE) {
       sendtmpbuf = static_cast<void*>(xbt_malloc(recvcount * comm->size() * recvtype->size()));
-      memcpy(sendtmpbuf, recvbuf, recvcount * comm->size() * recvtype->size());
+      //memcpy(??,nullptr,0) is actually undefined behavor, even if harmless.
+      if(recvbuf != nullptr)
+        memcpy(sendtmpbuf, recvbuf, recvcount * comm->size() * recvtype->size());
       sendtmpcount = recvcount;
       sendtmptype  = recvtype;
     }