diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-03-27 04:35:31 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-03-27 04:35:31 -0700 |
| commit | f06ca04451037bf4b250da55d408d06fc691c760 (patch) | |
| tree | 4acb5bad3ff79b071c150be39dddd20c3f62c484 /weed/filer2/filechunks.go | |
| parent | e1911760a773fadc236a3463cd2d6a4c0f2dd5d1 (diff) | |
| download | seaweedfs-f06ca04451037bf4b250da55d408d06fc691c760.tar.xz seaweedfs-f06ca04451037bf4b250da55d408d06fc691c760.zip | |
avoid overflow
Diffstat (limited to 'weed/filer2/filechunks.go')
| -rw-r--r-- | weed/filer2/filechunks.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/weed/filer2/filechunks.go b/weed/filer2/filechunks.go index fe7841fa7..4c972e14f 100644 --- a/weed/filer2/filechunks.go +++ b/weed/filer2/filechunks.go @@ -3,6 +3,7 @@ package filer2 import ( "fmt" "hash/fnv" + "math" "sort" "sync" @@ -86,6 +87,12 @@ func ViewFromChunks(chunks []*filer_pb.FileChunk, offset int64, size int64) (vie func ViewFromVisibleIntervals(visibles []VisibleInterval, offset int64, size int64) (views []*ChunkView) { stop := offset + size + if size == math.MaxInt64 { + stop = math.MaxInt64 + } + if stop < offset { + stop = math.MaxInt64 + } for _, chunk := range visibles { |
