-
Notifications
You must be signed in to change notification settings - Fork 193
Panic when adding to a non-existing array #171
Copy link
Copy link
Closed
Description
Hey folks,
we discovered that we get a panic if we apply the following operations to a JSON:
- op: replace, path: "/spec/template/spec/kubeadmConfigSpec/preKubeadmCommands", value: nil
- op: add, path: "/spec/template/spec/kubeadmConfigSpec/preKubeadmCommands/0", value: "some text"
The panic occurs here:
https://github.com/evanphx/json-patch/blob/master/v5/patch.go#L509-L513
I think the problem is that it is only checked if next is nil, but not next.raw. So then it panics in l.513 at *next.raw.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels