Skip to content

Commit

Permalink
chunked: ignore the tar-split data if digest is empty
Browse files Browse the repository at this point in the history
if a digest was not specified in the TOC, ignore completely the
tar-split data.

Otherwise the clients fail to pull images created before commit
b5413c2.

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Jun 3, 2024
1 parent a4090c4 commit 6875c9f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions pkg/chunked/compression_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,18 @@ func readZstdChunkedManifest(blobStream ImageSourceSeekable, tocDigest digest.Di

decodedTarSplit := []byte{}
if tarSplitChunk.Offset > 0 {
tarSplit, err := readBlob(tarSplitChunk.Length)
if err != nil {
return nil, nil, nil, 0, err
}

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)
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
}

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)
}
}
}
return decodedBlob, toc, decodedTarSplit, int64(manifestChunk.Offset), err
Expand Down

0 comments on commit 6875c9f

Please sign in to comment.