Skip to content

Commit 31dde70

Browse files
authored
Merge pull request moby#3618 from tonistiigi/gha-offset
gha: avoid range requests with too big offset
2 parents ad15d56 + 488791a commit 31dde70

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cache/remotecache/gha/gha.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"context"
66
"encoding/json"
77
"fmt"
8+
"io"
89
"os"
910
"sync"
1011
"time"
@@ -371,6 +372,13 @@ type readerAt struct {
371372
desc ocispecs.Descriptor
372373
}
373374

375+
func (r *readerAt) ReadAt(p []byte, off int64) (int, error) {
376+
if off >= r.desc.Size {
377+
return 0, io.EOF
378+
}
379+
return r.ReaderAtCloser.ReadAt(p, off)
380+
}
381+
374382
func (r *readerAt) Size() int64 {
375383
return r.desc.Size
376384
}

0 commit comments

Comments
 (0)