Skip to content

Commit

Permalink
Merge pull request #1050 from wader/progressreaderseeker-growing-file…
Browse files Browse the repository at this point in the history
…-fix

progressreaderseeker: Dont't index out of bounds for a growing file
  • Loading branch information
wader authored Dec 19, 2024
2 parents 36d738e + 8abd602 commit 8c0d6a4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/progressreadseeker/progressreaderseeker.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ func (prs *Reader) Read(p []byte) (n int, err error) {
partEnd := newPos / prs.partitionSize

for i := partStart; i < partEnd; i++ {
if prs.partitions[i] {
// protect reading from a growing file
if i >= int64(len(prs.partitions)) || prs.partitions[i] {
continue
}
prs.partitions[i] = true
Expand Down

0 comments on commit 8c0d6a4

Please sign in to comment.