Skip to content
Myr

Do not read more than 10K characters from /dev/tty

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This might help with #1456 where fzf hangs consuming CPU resources.

authored by Junegunn Choi · committed by Junegunn Choi · parent d9c6a03 · Browse files · 1 file+8 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−0 removed

  • other:+8 added−0 removed

1 file+8 added−0 removed

modified:src/tui/light.go+8 added
21 unmodified lines
2223 defaultEscDelay = 10024 escPollInterval = 525 offsetPollTries = 1026 maxInputBuffer = 10 * 102427)2829const consoleDevice string = "/dev/tty"30
286 unmodified lines
317 retries = 0318 }319 buffer = append(buffer, byte(c))320 pc = c321322 // This should never happen under normal conditions,323 // so terminate fzf immediately.324 if len(buffer) > maxInputBuffer {325 r.Close()326 panic(fmt.Sprintf("Input buffer overflow (%d): %v", len(buffer), buffer))327 }328 }329330 return buffer331}
650 unmodified lines