summaryrefslogtreecommitdiff
path: root/distribution
diff options
context:
space:
mode:
authorJohn Howard <jhoward@microsoft.com>2017-11-20 08:33:20 -0800
committerJohn Howard <jhoward@microsoft.com>2018-01-18 12:30:39 -0800
commit0cba7740d41369eee33b671f26276325580bc07b (patch)
tree316e33bfb0a48780e9d60040d2f6cb4d4edfac56 /distribution
parentafd305c4b5682fbc297e1685e2b7a49628b7c7f0 (diff)
downloaddocker-0cba7740d41369eee33b671f26276325580bc07b.tar.gz
Address feedback from Tonis
Signed-off-by: John Howard <jhoward@microsoft.com>
Diffstat (limited to 'distribution')
-rw-r--r--distribution/config.go3
-rw-r--r--distribution/push_v1.go4
-rw-r--r--distribution/xfer/download.go7
3 files changed, 13 insertions, 1 deletions
diff --git a/distribution/config.go b/distribution/config.go
index eea5c3283b..f42c9670ff 100644
--- a/distribution/config.go
+++ b/distribution/config.go
@@ -158,6 +158,9 @@ func (s *imageConfigStore) RootFSAndOSFromConfig(c []byte) (*image.RootFS, strin
if os == "" {
os = runtime.GOOS
}
+ if !system.IsOSSupported(os) {
+ return nil, "", system.ErrNotSupportedOperatingSystem
+ }
return unmarshalledConfig.RootFS, os, nil
}
diff --git a/distribution/push_v1.go b/distribution/push_v1.go
index b4cb003bb9..6dbc110110 100644
--- a/distribution/push_v1.go
+++ b/distribution/push_v1.go
@@ -14,6 +14,7 @@ import (
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/progress"
"github.com/docker/docker/pkg/stringid"
+ "github.com/docker/docker/pkg/system"
"github.com/docker/docker/registry"
"github.com/opencontainers/go-digest"
"github.com/sirupsen/logrus"
@@ -210,6 +211,9 @@ func (p *v1Pusher) imageListForTag(imgID image.ID, dependenciesSeen map[layer.Ch
topLayerID := img.RootFS.ChainID()
+ if !system.IsOSSupported(img.OperatingSystem()) {
+ return nil, system.ErrNotSupportedOperatingSystem
+ }
pl, err := p.config.LayerStores[img.OperatingSystem()].Get(topLayerID)
*referencedLayers = append(*referencedLayers, pl)
if err != nil {
diff --git a/distribution/xfer/download.go b/distribution/xfer/download.go
index e20e9668a4..1ccb91a14f 100644
--- a/distribution/xfer/download.go
+++ b/distribution/xfer/download.go
@@ -13,6 +13,7 @@ import (
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/progress"
+ "github.com/docker/docker/pkg/system"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
)
@@ -105,10 +106,14 @@ func (ldm *LayerDownloadManager) Download(ctx context.Context, initialRootFS ima
downloadsByKey = make(map[string]*downloadTransfer)
)
- // Assume that the operating system is the host OS if blank
+ // Assume that the operating system is the host OS if blank, and validate it
+ // to ensure we don't cause a panic by an invalid index into the layerstores.
if os == "" {
os = runtime.GOOS
}
+ if !system.IsOSSupported(os) {
+ return image.RootFS{}, nil, system.ErrNotSupportedOperatingSystem
+ }
rootFS := initialRootFS
for _, descriptor := range layers {