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

@@ -130,8 +130,9 @@ func (f *IdentifierNode) String() string {
// ParamsEntry holds param information for ArrayNode
type ParamsEntry struct {
Value int
Known bool // whether the value is known when parse it
Value int
Known bool // whether the value is known when parse it
Derived bool
}
// ArrayNode holds start, end, step information for array index selection