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

.

parent cc6c155e
......@@ -483,6 +483,7 @@ import (
"fmt"
"io"
stdlog "log"
"math"
"os"
"runtime"
"sort"
......@@ -505,6 +506,7 @@ import (
"lab.nexedi.com/kirr/neo/go/zodb/btree"
_ "lab.nexedi.com/kirr/neo/go/zodb/wks"
"github.com/johncgriffin/overflow"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/fuse/nodefs"
"github.com/pkg/errors"
......@@ -1155,7 +1157,10 @@ func (f *BigFile) Read(_ nodefs.File, dest []byte, off int64, fctx *fuse.Context
defer f.head.zheadMu.RUnlock()
// 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 {
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