From 2e974f30ab728f2f105af30d4de9db01d02e9514 Mon Sep 17 00:00:00 2001 From: Cao Shufeng Date: Sun, 9 Sep 2018 13:06:39 +0800 Subject: [PATCH] vendor: bump github.com/evanphx/json-patch Grab important bug fix that can cause a `panic()` from this package on certain inputs. See https://github.com/evanphx/json-patch/pull/64 --- Godeps/Godeps.json | 4 ++-- .../Godeps/Godeps.json | 2 +- .../k8s.io/apimachinery/Godeps/Godeps.json | 2 +- .../src/k8s.io/apiserver/Godeps/Godeps.json | 2 +- .../src/k8s.io/cli-runtime/Godeps/Godeps.json | 2 +- .../k8s.io/kube-aggregator/Godeps/Godeps.json | 2 +- .../sample-apiserver/Godeps/Godeps.json | 2 +- .../sample-cli-plugin/Godeps/Godeps.json | 2 +- .../github.com/evanphx/json-patch/README.md | 2 +- vendor/github.com/evanphx/json-patch/patch.go | 23 ++++++++++--------- 10 files changed, 22 insertions(+), 21 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index ea7adcdab15..bf6372faaa7 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -1522,8 +1522,8 @@ }, { "ImportPath": "github.com/evanphx/json-patch", - "Comment": "v3.0.0-29-gf195058", - "Rev": "f195058310bd062ea7c754a834f0ff43b4b63afb" + "Comment": "v3.0.0-34-g36442db", + "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" }, { "ImportPath": "github.com/exponent-io/jsonpath", diff --git a/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json b/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json index 11a56668872..a807ce31150 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json @@ -388,7 +388,7 @@ }, { "ImportPath": "github.com/evanphx/json-patch", - "Rev": "f195058310bd062ea7c754a834f0ff43b4b63afb" + "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" }, { "ImportPath": "github.com/ghodss/yaml", diff --git a/staging/src/k8s.io/apimachinery/Godeps/Godeps.json b/staging/src/k8s.io/apimachinery/Godeps/Godeps.json index f0f8a91ae30..ba33fb991c0 100644 --- a/staging/src/k8s.io/apimachinery/Godeps/Godeps.json +++ b/staging/src/k8s.io/apimachinery/Godeps/Godeps.json @@ -24,7 +24,7 @@ }, { "ImportPath": "github.com/evanphx/json-patch", - "Rev": "f195058310bd062ea7c754a834f0ff43b4b63afb" + "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" }, { "ImportPath": "github.com/ghodss/yaml", diff --git a/staging/src/k8s.io/apiserver/Godeps/Godeps.json b/staging/src/k8s.io/apiserver/Godeps/Godeps.json index a252b243315..57ebc2154b5 100644 --- a/staging/src/k8s.io/apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/apiserver/Godeps/Godeps.json @@ -388,7 +388,7 @@ }, { "ImportPath": "github.com/evanphx/json-patch", - "Rev": "f195058310bd062ea7c754a834f0ff43b4b63afb" + "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" }, { "ImportPath": "github.com/ghodss/yaml", diff --git a/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json b/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json index 856739bfa78..9458287ff0b 100644 --- a/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json +++ b/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json @@ -12,7 +12,7 @@ }, { "ImportPath": "github.com/evanphx/json-patch", - "Rev": "f195058310bd062ea7c754a834f0ff43b4b63afb" + "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" }, { "ImportPath": "github.com/ghodss/yaml", diff --git a/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json b/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json index 94c62735888..a4ae3ae5fde 100644 --- a/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json +++ b/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json @@ -128,7 +128,7 @@ }, { "ImportPath": "github.com/evanphx/json-patch", - "Rev": "f195058310bd062ea7c754a834f0ff43b4b63afb" + "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" }, { "ImportPath": "github.com/ghodss/yaml", diff --git a/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json b/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json index 9f9bd3a06f5..94fb0604374 100644 --- a/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json @@ -120,7 +120,7 @@ }, { "ImportPath": "github.com/evanphx/json-patch", - "Rev": "f195058310bd062ea7c754a834f0ff43b4b63afb" + "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" }, { "ImportPath": "github.com/ghodss/yaml", diff --git a/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json b/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json index d0d30f26a3c..2e5854d5c61 100644 --- a/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json +++ b/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json @@ -8,7 +8,7 @@ "Deps": [ { "ImportPath": "github.com/evanphx/json-patch", - "Rev": "f195058310bd062ea7c754a834f0ff43b4b63afb" + "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" }, { "ImportPath": "github.com/ghodss/yaml", diff --git a/vendor/github.com/evanphx/json-patch/README.md b/vendor/github.com/evanphx/json-patch/README.md index 078629004d7..13b90420ca1 100644 --- a/vendor/github.com/evanphx/json-patch/README.md +++ b/vendor/github.com/evanphx/json-patch/README.md @@ -15,7 +15,7 @@ go get -u github.com/evanphx/json-patch ``` **Stable Versions**: -* Version 3: `go get -u gopkg.in/evanphx/json-patch.v3` +* Version 4: `go get -u gopkg.in/evanphx/json-patch.v4` (previous versions below `v3` are unavailable) diff --git a/vendor/github.com/evanphx/json-patch/patch.go b/vendor/github.com/evanphx/json-patch/patch.go index d88dc89c33f..3d76e9e38b0 100644 --- a/vendor/github.com/evanphx/json-patch/patch.go +++ b/vendor/github.com/evanphx/json-patch/patch.go @@ -236,7 +236,7 @@ func (o operation) path() string { } func (o operation) from() string { - if obj, ok := o["from"]; ok && obj != nil{ + if obj, ok := o["from"]; ok && obj != nil { var op string err := json.Unmarshal(*obj, &op) @@ -389,17 +389,13 @@ func (d *partialArray) add(key string, val *lazyNode) error { cur := *d - if idx < 0 { - idx *= -1 - - if idx > len(ary) { - return fmt.Errorf("Unable to access invalid index: %d", idx) - } - idx = len(ary) - idx - } - if idx < 0 || idx >= len(ary) || idx > len(cur) { + if idx < -len(ary) || idx >= len(ary) { return fmt.Errorf("Unable to access invalid index: %d", idx) } + + if idx < 0 { + idx += len(ary) + } copy(ary[0:idx], cur[0:idx]) ary[idx] = val copy(ary[idx+1:], cur[idx:]) @@ -430,9 +426,12 @@ func (d *partialArray) remove(key string) error { cur := *d - if idx >= len(cur) { + if idx < -len(cur) || idx >= len(cur) { return fmt.Errorf("Unable to remove invalid index: %d", idx) } + if idx < 0 { + idx += len(cur) + } ary := make([]*lazyNode, len(cur)-1) @@ -535,6 +534,8 @@ func (p Patch) test(doc *container, op operation) error { return nil } return fmt.Errorf("Testing value %s failed", path) + } else if op.value() == nil { + return fmt.Errorf("Testing value %s failed", path) } if val.equal(op.value()) {