[PATCH] D48948: Fix raw_fd_ostream::write_impl hang due to an infinite loop with large output
Owen Reynolds via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 18 06:41:42 PDT 2018
gbreynoo updated this revision to Diff 156057.
gbreynoo added a comment.
Made maximum write size portable as suggested by Rui
https://reviews.llvm.org/D48948
Files:
lib/Support/raw_ostream.cpp
Index: lib/Support/raw_ostream.cpp
===================================================================
--- lib/Support/raw_ostream.cpp
+++ lib/Support/raw_ostream.cpp
@@ -613,10 +613,10 @@
assert(FD >= 0 && "File already closed.");
pos += Size;
- // The maximum write size is limited to SSIZE_MAX because a write
- // greater than SSIZE_MAX is implementation-defined in POSIX.
- // Since SSIZE_MAX is not portable, we use SIZE_MAX >> 1 instead.
- size_t MaxWriteSize = SIZE_MAX >> 1;
+ // The maximum write size is limited to INT32_MAX. A write
+ // greater than SSIZE_MAX is implementation-defined in POSIX,
+ // and Windows _write requires 32 bit input.
+ size_t MaxWriteSize = INT32_MAX;
#if defined(__linux__)
// It is observed that Linux returns EINVAL for a very large write (>2G).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48948.156057.patch
Type: text/x-patch
Size: 810 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180718/425edcc6/attachment.bin>
More information about the llvm-commits
mailing list