From 8154c77bef1327aca76b83a1ec5177510f6b4b7b Mon Sep 17 00:00:00 2001 From: erw7 Date: Thu, 1 Oct 2020 16:53:21 +0900 Subject: screen.c: fix buffer overflow due to folding fixes #12988. --- src/nvim/screen.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index f3fdafcc70..3503348049 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2822,6 +2822,16 @@ win_line ( n_extra = wp->w_p_rl ? (col + 1) : (grid->Columns - col); } + if (draw_state == WL_LINE + && foldinfo.fi_level != 0 + && foldinfo.fi_lines > 0 + && col >= grid->Columns + && n_extra != 0 + && row == startrow) { + // Truncate the folding. + n_extra = 0; + } + if (draw_state == WL_LINE && (area_highlighting || has_spell)) { // handle Visual or match highlighting in this line if (vcol == fromcol -- cgit