mirror of https://github.com/minio/minio.git
s3zip: Limit over-read for single file (#16161)
This commit is contained in:
parent
1cd875de1e
commit
98cffbce03
|
@ -179,8 +179,13 @@ func (api objectAPIHandlers) getObjectInArchiveFileHandler(ctx context.Context,
|
||||||
var rc io.ReadCloser
|
var rc io.ReadCloser
|
||||||
|
|
||||||
if file.UncompressedSize64 > 0 {
|
if file.UncompressedSize64 > 0 {
|
||||||
// We do not know where the file ends, but the returned reader only returns UncompressedSize.
|
// There may be number of header bytes before the content.
|
||||||
rs := &HTTPRangeSpec{Start: file.Offset, End: -1}
|
// Reading 64K extra. This should more than cover name and any "extra" details.
|
||||||
|
end := file.Offset + int64(file.CompressedSize64) + 64<<10
|
||||||
|
if end > zipObjInfo.Size {
|
||||||
|
end = zipObjInfo.Size
|
||||||
|
}
|
||||||
|
rs := &HTTPRangeSpec{Start: file.Offset, End: end}
|
||||||
gr, err := objectAPI.GetObjectNInfo(ctx, bucket, zipPath, rs, nil, readLock, opts)
|
gr, err := objectAPI.GetObjectNInfo(ctx, bucket, zipPath, rs, nil, readLock, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
||||||
|
|
Loading…
Reference in New Issue