From 3429e9993085520ac902fef2ef6aabd57080bd36 Mon Sep 17 00:00:00 2001 From: "Iskander (Alex) Sharipov" Date: Fri, 8 Mar 2019 10:39:58 +0300 Subject: image: do actual RootFS.DiffIDs copying in Clone() append(newRoot.DiffIDs) without element does nothing, so it's probably not what was intended. Changed code to perform a slice copying instead. Fixes #38834. Signed-off-by: Iskander Sharipov --- image/rootfs.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'image') diff --git a/image/rootfs.go b/image/rootfs.go index 84843e10c6..f73a0660fa 100644 --- a/image/rootfs.go +++ b/image/rootfs.go @@ -38,7 +38,8 @@ func (r *RootFS) Append(id layer.DiffID) { func (r *RootFS) Clone() *RootFS { newRoot := NewRootFS() newRoot.Type = r.Type - newRoot.DiffIDs = append(r.DiffIDs) + newRoot.DiffIDs = make([]layer.DiffID, len(r.DiffIDs)) + copy(newRoot.DiffIDs, r.DiffIDs) return newRoot } -- cgit v1.2.1