summaryrefslogtreecommitdiff
path: root/distribution/pull_v2.go
diff options
context:
space:
mode:
Diffstat (limited to 'distribution/pull_v2.go')
-rw-r--r--distribution/pull_v2.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/distribution/pull_v2.go b/distribution/pull_v2.go
index 3307458fdf..cb47264b9a 100644
--- a/distribution/pull_v2.go
+++ b/distribution/pull_v2.go
@@ -477,6 +477,9 @@ func (p *v2Puller) pullSchema1(ctx context.Context, ref reference.Reference, unv
// to top-most, so that the downloads slice gets ordered correctly.
for i := len(verifiedManifest.FSLayers) - 1; i >= 0; i-- {
blobSum := verifiedManifest.FSLayers[i].BlobSum
+ if err = blobSum.Validate(); err != nil {
+ return "", "", errors.Wrapf(err, "could not validate layer digest %q", blobSum)
+ }
var throwAway struct {
ThrowAway bool `json:"throwaway,omitempty"`
@@ -575,6 +578,9 @@ func (p *v2Puller) pullSchema2Layers(ctx context.Context, target distribution.De
// Note that the order of this loop is in the direction of bottom-most
// to top-most, so that the downloads slice gets ordered correctly.
for _, d := range layers {
+ if err := d.Digest.Validate(); err != nil {
+ return "", errors.Wrapf(err, "could not validate layer digest %q", d.Digest)
+ }
layerDescriptor := &v2LayerDescriptor{
digest: d.Digest,
repo: p.repo,