Browse Source
win: handle more than 2048 processes (#10997)
Fix an array out of bounds crash
brucemacd/benchmark-list
Daniel Hiltgen
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
10 additions and
1 deletions
-
cmd/start_windows.go
|
|
|
@ -74,7 +74,16 @@ func isProcRunning(procName string) []uint32 { |
|
|
|
slog.Debug("failed to check for running installers", "error", err) |
|
|
|
return nil |
|
|
|
} |
|
|
|
pids = pids[:ret] |
|
|
|
if ret > uint32(len(pids)) { |
|
|
|
pids = make([]uint32, ret+10) |
|
|
|
if err := windows.EnumProcesses(pids, &ret); err != nil || ret == 0 { |
|
|
|
slog.Debug("failed to check for running installers", "error", err) |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
if ret < uint32(len(pids)) { |
|
|
|
pids = pids[:ret] |
|
|
|
} |
|
|
|
var matches []uint32 |
|
|
|
for _, pid := range pids { |
|
|
|
if pid == 0 { |
|
|
|
|