openshift / jenkins

Apache License 2.0
260 stars 447 forks source link

nil pointer dereference in go-init/main.go #1690

Closed InQuirer closed 1 year ago

InQuirer commented 1 year ago

Jenkins log:

2023/06/01 07:59:24 [go-init] No pre-start command defined, skip
2023/06/01 07:59:24 [go-init] Main command launched : /usr/libexec/s2i/run
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4a70b2]
goroutine 33 [running]:
main.run.func1()
/go/src/github.com/openshift/jenkins/go-init/main.go:161 +0x92
created by main.run
/go/src/github.com/openshift/jenkins/go-init/main.go:155 +0x22f

it seems like there should be a NN check as cmd.Process is not initially assigned and calling cmd.Start does not guarantee it https://github.com/openshift/jenkins/blob/0260b725850c84b05a778d0bcb1dc6993536d7bb/2/go-init/main.go#L161 stdlib ref: https://cs.opensource.google/go/go/+/master:src/os/exec/exec.go;l=693

coreydaley commented 1 year ago

Thanks for finding that, would you be interested in opening a pull request to fix the issue?