From 0284ed47bfa6a30d06972491fe2f03c53721c18f Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Thu, 16 May 2019 23:14:17 +0200 Subject: [PATCH] Don't take buffer on stack, 4M may be too big. --- src/smpi/internals/smpi_global.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/smpi/internals/smpi_global.cpp b/src/smpi/internals/smpi_global.cpp index 766a09adae..66ebe69144 100644 --- a/src/smpi/internals/smpi_global.cpp +++ b/src/smpi/internals/smpi_global.cpp @@ -507,7 +507,7 @@ static void smpi_copy_file(const std::string& src, const std::string& target, of #endif // If this point is reached, sendfile() actually is not available. Copy file by hand. const int bufsize = 1024 * 1024 * 4; - char buf[bufsize]; + char* buf = new char[bufsize]; while (int got = read(fdin, buf, bufsize)) { if (got == -1) { xbt_assert(errno == EINTR, "Cannot read from %s", src.c_str()); @@ -524,6 +524,7 @@ static void smpi_copy_file(const std::string& src, const std::string& target, of } } } + delete[] buf; close(fdin); close(fdout); } -- 2.20.1