mirror of
https://github.com/dogkeeper886/ollama37.git
synced 2025-12-10 15:57:04 +00:00
win: handle more than 2048 processes (#10997)
Fix an array out of bounds crash
This commit is contained in:
@@ -74,7 +74,16 @@ func isProcRunning(procName string) []uint32 {
|
|||||||
slog.Debug("failed to check for running installers", "error", err)
|
slog.Debug("failed to check for running installers", "error", err)
|
||||||
return nil
|
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
|
var matches []uint32
|
||||||
for _, pid := range pids {
|
for _, pid := range pids {
|
||||||
if pid == 0 {
|
if pid == 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user