Skip to content

Commit 0e5793e

Browse files
committed
be sure part size doesn't overflow
1 parent a3402fb commit 0e5793e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

s3util/uploader.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type uploader struct {
4141
url string
4242
UploadId string // written by xml decoder
4343

44-
bufsz int
44+
bufsz int64
4545
buf []byte
4646
off int
4747
ch chan *part
@@ -117,7 +117,7 @@ func (u *uploader) Write(p []byte) (n int, err error) {
117117
}
118118
for n < len(p) {
119119
if cap(u.buf) == 0 {
120-
u.buf = make([]byte, u.bufsz)
120+
u.buf = make([]byte, int(u.bufsz))
121121
// Increase part size (1.001x).
122122
// This lets us reach the max object size (5TiB) while
123123
// still doing minimal buffering for small objects.
@@ -248,7 +248,7 @@ func (u *uploader) abort() {
248248
}
249249
}
250250

251-
func min(a, b int) int {
251+
func min(a, b int64) int64 {
252252
if a < b {
253253
return a
254254
}

0 commit comments

Comments
 (0)