Commit 88a26456 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent cc6c155e
...@@ -483,6 +483,7 @@ import ( ...@@ -483,6 +483,7 @@ import (
"fmt" "fmt"
"io" "io"
stdlog "log" stdlog "log"
"math"
"os" "os"
"runtime" "runtime"
"sort" "sort"
...@@ -505,6 +506,7 @@ import ( ...@@ -505,6 +506,7 @@ import (
"lab.nexedi.com/kirr/neo/go/zodb/btree" "lab.nexedi.com/kirr/neo/go/zodb/btree"
_ "lab.nexedi.com/kirr/neo/go/zodb/wks" _ "lab.nexedi.com/kirr/neo/go/zodb/wks"
"github.com/johncgriffin/overflow"
"github.com/hanwen/go-fuse/fuse" "github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/fuse/nodefs" "github.com/hanwen/go-fuse/fuse/nodefs"
"github.com/pkg/errors" "github.com/pkg/errors"
...@@ -1155,7 +1157,10 @@ func (f *BigFile) Read(_ nodefs.File, dest []byte, off int64, fctx *fuse.Context ...@@ -1155,7 +1157,10 @@ func (f *BigFile) Read(_ nodefs.File, dest []byte, off int64, fctx *fuse.Context
defer f.head.zheadMu.RUnlock() defer f.head.zheadMu.RUnlock()
// cap read request to file size // cap read request to file size
end := off + int64(len(dest)) // XXX overflow? end, ok := overflow.Add64(off, int64(len(dest)))
if !ok {
end = math.MaxInt64 // cap read request till max possible file size
}
if end > f.size { if end > f.size {
end = f.size end = f.size
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment