aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2025-02-21 00:57:26 -0800
committerchrislu <chris.lu@gmail.com>2025-02-21 00:57:26 -0800
commit299e372b48d0caddb3d25995ba333e53d4e474a6 (patch)
treed2a3fcbd18017e89a23b62f36ad8d9bdaa10989f
parent60c9a7496deaf475f35a59ecd0500d3e916e368d (diff)
downloadseaweedfs-299e372b48d0caddb3d25995ba333e53d4e474a6.tar.xz
seaweedfs-299e372b48d0caddb3d25995ba333e53d4e474a6.zip
prevent reading wrong data
fix https://github.com/seaweedfs/seaweedfs/issues/6565
-rw-r--r--weed/filer/filechunk_group.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/weed/filer/filechunk_group.go b/weed/filer/filechunk_group.go
index ebda62845..752238de9 100644
--- a/weed/filer/filechunk_group.go
+++ b/weed/filer/filechunk_group.go
@@ -56,6 +56,9 @@ func (group *ChunkGroup) ReadDataAt(fileSize int64, buff []byte, offset int64) (
for si := sectionIndexStart; si < sectionIndexStop+1; si++ {
section, found := group.sections[si]
rangeStart, rangeStop := max(offset, int64(si*SectionSize)), min(offset+int64(len(buff)), int64((si+1)*SectionSize))
+ if rangeStart >= rangeStop {
+ continue
+ }
if !found {
rangeStop = min(rangeStop, fileSize)
for i := rangeStart; i < rangeStop; i++ {