m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-17 07:43:39 -05:00

Fix panic on unexpected escape sequences

This commit is contained in:
Junegunn Choi
2020-02-24 01:37:08 +09:00
parent 5cae8ea733
commit ec75d16ea8

View File

@@ -467,7 +467,7 @@ func (r *LightRenderer) escSequence(sz *int) Event {
}
}
// Bracketed paste mode: \e[200~ ... \e[201~
if r.buffer[3] == '0' && (r.buffer[4] == '0' || r.buffer[4] == '1') && r.buffer[5] == '~' {
if len(r.buffer) > 5 && r.buffer[3] == '0' && (r.buffer[4] == '0' || r.buffer[4] == '1') && r.buffer[5] == '~' {
// Immediately discard the sequence from the buffer and reread input
r.buffer = r.buffer[6:]
*sz = 0