fix a client-go bug which could casue kubectl panic (#72952)

* When user try execute command like `kubectl get pod test -o custom-columns=CONTAINER:.spec.containers[-1].name`
It will throw a panic about slice index out of bounds. This patch fix it.

* add test case

Kubernetes-commit: 1e245fad87584a28809f8f5d380b766edfa984ec
This commit is contained in:
WanLinghao
2019-01-19 08:14:20 +08:00
committed by Kubernetes Publisher
parent 837b88074c
commit 4b473f5dc7
5 changed files with 169 additions and 7 deletions

View File

@@ -325,6 +325,7 @@ Loop:
if i == 1 {
params[i].Known = true
params[i].Value = params[0].Value + 1
params[i].Derived = true
} else {
params[i].Known = false
params[i].Value = 0