vim-patch:7.4.562 #2593

Problem:    Segfault with wide screen and error in 'rulerformat'. (Ingo Karkat)
Solution:   Check there is enough space. (Christian Brabandt)

https://github.com/vim/vim/commit/v7-4-562
This commit is contained in:
David Bürgin
2015-05-03 17:03:39 +02:00
committed by Justin M. Keyes
parent f525284778
commit 7a7d082e12
3 changed files with 8 additions and 2 deletions

View File

@@ -3511,6 +3511,11 @@ build_stl_str_hl (
*/ */
void get_rel_pos(win_T *wp, char_u *buf, int buflen) void get_rel_pos(win_T *wp, char_u *buf, int buflen)
{ {
// Need at least 3 chars for writing.
if (buflen < 3) {
return;
}
long above; /* number of lines above window */ long above; /* number of lines above window */
long below; /* number of lines below window */ long below; /* number of lines below window */

View File

@@ -7106,7 +7106,8 @@ static void win_redr_ruler(win_T *wp, int always)
if (this_ru_col < (width + 1) / 2) if (this_ru_col < (width + 1) / 2)
this_ru_col = (width + 1) / 2; this_ru_col = (width + 1) / 2;
if (this_ru_col + o < width) { if (this_ru_col + o < width) {
while (this_ru_col + o < width) { // Need at least 3 chars left for get_rel_pos() + NUL.
while (this_ru_col + o < width && RULER_BUF_LEN > i + 4) {
if (has_mbyte) if (has_mbyte)
i += (*mb_char2bytes)(fillchar, buffer + i); i += (*mb_char2bytes)(fillchar, buffer + i);
else else

View File

@@ -221,7 +221,7 @@ static int included_patches[] = {
565, 565,
//564 NA //564 NA
563, 563,
//562, 562,
561, 561,
//560 NA //560 NA
559, 559,