diff options
author | zeertzjq <zeertzjq@outlook.com> | 2021-12-08 08:41:46 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2021-12-08 08:41:46 +0800 |
commit | c83fedf0bd0cb39ed4706113029b3e358f141707 (patch) | |
tree | 61be7fb93111e137c61c26b06a189b1767535564 /src | |
parent | be768be6b7ee896277971593e9287a86bc41efb2 (diff) | |
download | rneovim-c83fedf0bd0cb39ed4706113029b3e358f141707.tar.gz rneovim-c83fedf0bd0cb39ed4706113029b3e358f141707.tar.bz2 rneovim-c83fedf0bd0cb39ed4706113029b3e358f141707.zip |
fix(terminal): return early if there are no invalid rows
Prevent on_lines emitting out-of-bounds line indexes.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/terminal.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 83ade74db1..e7c2713e10 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -1508,6 +1508,13 @@ static void refresh_screen(Terminal *term, buf_T *buf) // Terminal height may have decreased before `invalid_end` reflects it. term->invalid_end = MIN(term->invalid_end, height); + // There are no invalid rows. + if (term->invalid_start >= term->invalid_end) { + term->invalid_start = INT_MAX; + term->invalid_end = -1; + return; + } + for (int r = term->invalid_start, linenr = row_to_linenr(term, r); r < term->invalid_end; r++, linenr++) { fetch_row(term, r, width); |