mirror of
https://github.com/octoleo/restic.git
synced 2024-12-23 11:28:54 +00:00
Fix BufferLoader for negative offset
This commit is contained in:
parent
71924fb7c0
commit
a5cbbb8b5a
@ -32,7 +32,7 @@ func (b BufferLoader) Load(p []byte, off int64) (int, error) {
|
||||
case off > int64(len(b)):
|
||||
return 0, errors.New("offset is larger than data")
|
||||
case off < -int64(len(b)):
|
||||
return 0, errors.New("offset starts before the beginning of the data")
|
||||
off = 0
|
||||
case off < 0:
|
||||
off = int64(len(b)) + off
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user