diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-08-28 14:15:49 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-28 14:15:49 -0400 |
commit | a5085b06a5877c8df84c56041820351e24e24ad1 (patch) | |
tree | a44cebf8f2b99ee5afcac7bf1f3286a95cc328cd /libpod/image | |
parent | 522a32f827aacdb4ad44fcb06516d1d659dbacda (diff) | |
parent | a6f85861df406ae7d44c25c1cbeecc1d267b9f43 (diff) | |
download | podman-a5085b06a5877c8df84c56041820351e24e24ad1.tar.gz podman-a5085b06a5877c8df84c56041820351e24e24ad1.tar.bz2 podman-a5085b06a5877c8df84c56041820351e24e24ad1.zip |
Merge pull request #7448 from baude/issue7444
fix panic when checking len on nil object
Diffstat (limited to 'libpod/image')
-rw-r--r-- | libpod/image/image.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libpod/image/image.go b/libpod/image/image.go index 6106084d5..dee2ce0ee 100644 --- a/libpod/image/image.go +++ b/libpod/image/image.go @@ -1246,7 +1246,12 @@ func areParentAndChild(parent, child *imgspecv1.Image) bool { // the child and candidate parent should share all of the // candidate parent's diff IDs, which together would have // controlled which layers were used - if len(parent.RootFS.DiffIDs) > len(child.RootFS.DiffIDs) { + + // issue #7444 describes a panic where the length of child.RootFS.DiffIDs + // is checked but child is nil. Adding a simple band-aid approach to prevent + // the problem until the origin of the problem can be worked out in the issue + // itself. + if child == nil || len(parent.RootFS.DiffIDs) > len(child.RootFS.DiffIDs) { return false } childUsesCandidateDiffs := true |