From ec75d16ea8f28768336f6f4a6992e3f838bc18fd Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 24 Feb 2020 01:37:08 +0900 Subject: [PATCH] Fix panic on unexpected escape sequences --- src/tui/light.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tui/light.go b/src/tui/light.go index c32a1baa..02f12d0f 100644 --- a/src/tui/light.go +++ b/src/tui/light.go @@ -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