Merge pull request #1942 from giuseppe/always-consume-tar-split-data

chunked: fix deadlock by always consuming tar-split
This commit is contained in:
openshift-merge-bot[bot] 2024-06-04 13:38:23 +00:00 committed by GitHub
commit 45933193bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 8 deletions

View File

@ -210,14 +210,13 @@ func readZstdChunkedManifest(blobStream ImageSourceSeekable, tocDigest digest.Di
decodedTarSplit := []byte{}
if tarSplitChunk.Offset > 0 {
tarSplitDigest := toc.TarSplitDigest.String()
// ignore the tar-split data if the digest was not specified
if tarSplitDigest != "" {
tarSplit, err := readBlob(tarSplitChunk.Length)
if err != nil {
return nil, nil, nil, 0, err
}
// we must consume the data to not block the producer
tarSplit, err := readBlob(tarSplitChunk.Length)
if err != nil {
return nil, nil, nil, 0, err
}
// but ignore it when the digest is not present, because we cant authenticate it against tocDigest
if toc.TarSplitDigest != "" {
decodedTarSplit, err = decodeAndValidateBlob(tarSplit, tarSplitLengthUncompressed, toc.TarSplitDigest.String())
if err != nil {
return nil, nil, nil, 0, fmt.Errorf("validating and decompressing tar-split: %w", err)