aboutsummaryrefslogtreecommitdiff
path: root/src/os
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2024-10-29 11:46:25 -0700
committerGopher Robot <gobot@golang.org>2024-10-30 20:15:22 +0000
commit4efd5191653293d98ba2a89ea9a5667bbf9abd15 (patch)
tree7255c6bec4b111c98434bdc41d84731b1ac37400 /src/os
parent0fd414c652f766e803d7a9b4f70daebd542dd6ab (diff)
downloadgo-4efd5191653293d98ba2a89ea9a5667bbf9abd15.tar.xz
internal/poll: avoid overflow in sendfile limit, simplify Solaris
Avoid integer overflow when passing a number of bytes to sendfile. Also, Solaris might not support passing a 0 length to read to the end of a file, but it does support passing a very large length. So just do that instead of looking up the source file size. Change-Id: Ibf750892938d9e2bafb1256c6e380c88899495f4 Reviewed-on: https://go-review.googlesource.com/c/go/+/623315 TryBot-Bypass: Ian Lance Taylor <iant@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/os')
-rw-r--r--src/os/copy_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/os/copy_test.go b/src/os/copy_test.go
index 407a59af42..6fe7f6e53b 100644
--- a/src/os/copy_test.go
+++ b/src/os/copy_test.go
@@ -98,7 +98,7 @@ func TestCopyFileToFile(t *testing.T) {
for _, srcStart := range []int64{0, 100, size} {
remaining := size - srcStart
for _, dstStart := range []int64{0, 200} {
- for _, limit := range []int64{remaining, remaining - 100, size * 2} {
+ for _, limit := range []int64{remaining, remaining - 100, size * 2, 0} {
if limit < 0 {
continue
}