Fix nil pointer dereference in nvproxy specutils

PiperOrigin-RevId: 609551204
This commit is contained in:
Zach Koopmans
2024-02-22 17:23:07 -08:00
committed by gVisor bot
parent 5f86d63fdd
commit 89ccdfe98a
+6 -3
View File
@@ -98,9 +98,12 @@ func isNvidiaHookPresent(spec *specs.Spec, conf *config.Config) bool {
// This has the effect of injecting the nvidia-container-runtime-hook.
return true
}
for _, h := range spec.Hooks.Prestart {
if strings.HasSuffix(h.Path, "/nvidia-container-runtime-hook") {
return true
if spec.Hooks != nil {
for _, h := range spec.Hooks.Prestart {
if strings.HasSuffix(h.Path, "/nvidia-container-runtime-hook") {
return true
}
}
}
return false