Skip to content

Commit

Permalink
Merge pull request #2120 from crazy-max/fix-nil-deref
Browse files Browse the repository at this point in the history
copy: fix nil pointer dereference when checking compression algorithm
  • Loading branch information
mtrmac committed Sep 18, 2023
2 parents 83f3807 + 635e0cd commit 27b3a7e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions copy/single.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,9 @@ func (ic *imageCopier) compareImageDestinationManifestEqual(ctx context.Context,

compressionAlgos := set.New[string]()
for _, srcInfo := range ic.src.LayerInfos() {
compression := compressionAlgorithmFromMIMEType(srcInfo)
compressionAlgos.Add(compression.Name())
if c := compressionAlgorithmFromMIMEType(srcInfo); c != nil {
compressionAlgos.Add(c.Name())
}
}

algos, err := algorithmsByNames(compressionAlgos.Values())
Expand Down

0 comments on commit 27b3a7e

Please sign in to comment.