screen.c: fix buffer overflow due to folding

fixes #12988.
This commit is contained in:
erw7
2020-10-01 16:53:21 +09:00
parent 36a5c394a5
commit 8154c77bef
2 changed files with 34 additions and 0 deletions

View File

@@ -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