diff --git a/iSulad-img.spec b/iSulad-img.spec index f2dd692ce90322f32f7364e893ab3f2683f55112..a61eacb0c32fdc87d632d9a3b038f8368d823663 100644 --- a/iSulad-img.spec +++ b/iSulad-img.spec @@ -1,5 +1,5 @@ %global _version 2.0.0 -%global _release 20200527.141725.git98f65913 +%global _release 20200608.153239.gitf3fd7793 Name: iSulad-img Version: %{_version} Release: %{_release} diff --git a/patch/0056-make-sure-created-time-is-larger-or-equal-than-1970.patch b/patch/0056-make-sure-created-time-is-larger-or-equal-than-1970.patch new file mode 100644 index 0000000000000000000000000000000000000000..10e657adf584089ded17bdce9692491b9b2e3d25 --- /dev/null +++ b/patch/0056-make-sure-created-time-is-larger-or-equal-than-1970.patch @@ -0,0 +1,55 @@ +From cc357cbce3222091e7a952f0320f8cdf2363cb37 Mon Sep 17 00:00:00 2001 +From: WangFengTu +Date: Mon, 8 Jun 2020 15:02:55 +0800 +Subject: [PATCH] make sure created time is larger or equal than 1970 + +Signed-off-by: WangFengTu +--- + .../containers/image/docker/tarfile/src.go | 24 +++++++++++++++++++ + 1 file changed, 24 insertions(+) + +diff --git a/vendor/github.com/containers/image/docker/tarfile/src.go b/vendor/github.com/containers/image/docker/tarfile/src.go +index 82e30a3..c8b4f4e 100644 +--- a/vendor/github.com/containers/image/docker/tarfile/src.go ++++ b/vendor/github.com/containers/image/docker/tarfile/src.go +@@ -238,6 +238,26 @@ func mainfestIndex(tarManifest []ManifestItem, repoTag string) (int, error) { + return 0, fmt.Errorf("RepoTag %v not found in tar archive\n", repoTag) + } + ++func validConfig(config *manifest.Schema2Image) error { ++ // Linux time start from 1970-01-01 00:00:00 +0000 (UTC) ++ // If year is less then 1970, decode time string may fail. ++ const yearMin int = 1970 ++ ++ year := config.Created.Year() ++ if year < yearMin { ++ return fmt.Errorf("Invalid year %v of created, min is %v", year, yearMin) ++ } ++ ++ for _, h := range config.History { ++ year = h.Created.Year() ++ if year < yearMin { ++ return fmt.Errorf("Invalid year %v of created in history, min is %v", year, yearMin) ++ } ++ } ++ ++ return nil ++} ++ + // ensureCachedDataIsPresent loads data necessary for any of the public accessors. + func (s *Source) ensureCachedDataIsPresent() error { + if s.tarManifest != nil { +@@ -269,6 +289,10 @@ func (s *Source) ensureCachedDataIsPresent() error { + return errors.Wrapf(err, "Error decoding tar config %s", tarManifest[mIndex].Config) + } + ++ if err := validConfig(&parsedConfig); err != nil { ++ return errors.Wrapf(err, "Error validating tar config %s", tarManifest[mIndex].Config) ++ } ++ + knownLayers, err := s.prepareLayerData(&tarManifest[mIndex], &parsedConfig) + if err != nil { + return err +-- +2.20.1 + diff --git a/patch/series-patch.conf b/patch/series-patch.conf index 1f97ba43bf07cf13c06a968e080d8633217f9c20..3c4acaa63861af2a71a041dc14f9db84f0d21165 100644 --- a/patch/series-patch.conf +++ b/patch/series-patch.conf @@ -53,3 +53,4 @@ 0053-support-pull-image-of-schema1.patch 0054-Change-copyright-from-Mulan-PSL-v1-to-Mulan-PSL-v2.patch 0055-Change-copyright-from-MulanPSL-to-MulanPSL2.patch +0056-make-sure-created-time-is-larger-or-equal-than-1970.patch