Browse Source

mount: avoid possible index out of bounds error

pull/2727/head
chrislu 3 years ago
parent
commit
da76af187f
  1. 6
      weed/filer/reader_cache.go

6
weed/filer/reader_cache.go

@ -183,6 +183,10 @@ func (s *SingleChunkCacher) readChunkAt(buf []byte, offset int64) (int, error) {
s.RLock() s.RLock()
defer s.RUnlock() defer s.RUnlock()
return copy(buf, s.data[offset:]), s.err
if s.err != nil {
return 0, s.err
}
return copy(buf, s.data[offset:]), nil
} }
Loading…
Cancel
Save