Skip to content

Commit 1147b6c

Browse files
committed
fix: negative start bigger than the file size
1 parent a1ae111 commit 1147b6c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

gateway/serve_http_content.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,10 @@ func seekToRangeStart(data io.Seeker, ra *ByteRange, size int64) error {
482482
if ra.To != nil {
483483
return fmt.Errorf("invalid range: negative start without a nil end")
484484
}
485-
start = size + ra.From
485+
start = size + ra.From - 1
486+
if start < 0 {
487+
return fmt.Errorf("invalid range: negative start bigger than the file size")
488+
}
486489
} else {
487490
start = ra.From
488491
}

0 commit comments

Comments
 (0)