nil pointer dereference on invalid filepath in `helm lint -f`
- Dominant language
- Go
- Stars
- 30.2k
- Forks
- 7.8k
- Avg merge
- 20h 58m
- Merged PRs (30d)
- 36
Description
By running
```bash
helm lint -f valu%s.yaml
# OR
helm lint -f %
# OR
helm lint -f :
```
helm throws an SIGSEGV.
```
% helm lint -f valu%s.yaml
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x226ad1c]
goroutine 1 [running]:
helm.sh/helm/v3/pkg/cli/values.readFile(0xc0006f6e70, 0xb, 0xc000244700, 0x2, 0x2, 0x3b54008, 0x0, 0x1, 0xc000665710, 0xc0002e7b60)
/private/tmp/helm-20200423-41927-615sa8/src/helm.sh/helm/pkg/cli/values/options.go:115 +0x6c
helm.sh/helm/v3/pkg/cli/values.(*Options).MergeValues(0xc000681bc0, 0xc000244700, 0x2, 0x2, 0xc00043abc0, 0x1, 0x1)
/private/tmp/helm-20200423-41927-615sa8/src/helm.sh/helm/pkg/cli/values/options.go:48 +0x114
main.newLintCmd.func1(0xc00042a580, 0xc00000eea0, 0x0, 0x2, 0x0, 0x0)
/private/tmp/helm-20200423-41927-615sa8/src/helm.sh/helm/cmd/helm/lint.go:72 +0x35f
github.com/spf13/cobra.(*Command).execute(0xc00042a580, 0xc00000ee80, 0x2, 0x2, 0xc00042a580, 0xc00000ee80)
/private/tmp/helm-20200423-41927-615sa8/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:842 +0x460
github.com/spf13/cobra.(*Command).ExecuteC(0xc0000f1340, 0x2973300, 0xc0001049a0, 0xc0005ed964)
/private/tmp/helm-20200423-41927-615sa8/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950 +0x349
github.com/spf13/cobra.(*Command).Execute(...)
/private/tmp/helm-20200423-41927-615sa8/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
main.main()
/private/tmp/helm-20200423-41927-615sa8/src/helm.sh/helm/cmd/helm/helm.go:83 +0x206
```
It doesn't matter if `%` exists.
Output of `helm version`:
```
version.BuildInfo{Version:"v3.2.0", GitCommit:"e11b7ce3b12db2941e90399e874513fbd24bcb71", GitTreeState:"clean", GoVersion:"go1.13.10"}
```
OS: macOS 10.15.4
Contributor guide
Assessment
This issue has not been assessed yet.