fix invalid file read (#6024)

This commit is contained in:
Guang Jiong Lou
2024-09-16 23:45:50 +08:00
committed by GitHub
parent 0da9e40abb
commit 367e7638d7
2 changed files with 8 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
package filer
import (
"io"
"sync"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
@@ -44,6 +45,9 @@ func (group *ChunkGroup) AddChunk(chunk *filer_pb.FileChunk) error {
}
func (group *ChunkGroup) ReadDataAt(fileSize int64, buff []byte, offset int64) (n int, tsNs int64, err error) {
if offset >= fileSize {
return 0, 0, io.EOF
}
group.sectionsLock.RLock()
defer group.sectionsLock.RUnlock()