diff options
author | Bram Moolenaar <Bram@vim.org> | 2015-01-07 13:31:52 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2015-01-07 13:31:52 +0100 |
commit | 0027c218e9ba174e2884e9361ab9183c4d003dd7 (patch) | |
tree | d595779c22ab3f79b1f1f08c05af0ef08c2ee824 | |
parent | abe382cd2ac032827d7ef286f3c19b21e85f30d4 (diff) | |
download | vim-0027c218e9ba174e2884e9361ab9183c4d003dd7.zip |
updated for version 7.4.562
Problem: Segfault with wide screen and error in 'rulerformat'. (Ingo Karkat)
Solution: Check there is enough space. (Christian Brabandt)
-rw-r--r-- | src/buffer.c | 2 | ||||
-rw-r--r-- | src/screen.c | 3 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 6 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c index 37182e146..0d1470606 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -4409,6 +4409,8 @@ get_rel_pos(wp, buf, buflen) long above; /* number of lines above window */ long below; /* number of lines below window */ + if (buflen < 3) /* need at least 3 chars for writing */ + return; above = wp->w_topline - 1; #ifdef FEAT_DIFF above += diff_check_fill(wp, wp->w_topline) - wp->w_topfill; diff --git a/src/screen.c b/src/screen.c index e7b8e78d7..290dd1bd3 100644 --- a/src/screen.c +++ b/src/screen.c @@ -10588,7 +10588,8 @@ win_redr_ruler(wp, always) this_ru_col = (WITH_WIDTH(width) + 1) / 2; if (this_ru_col + o < WITH_WIDTH(width)) { - while (this_ru_col + o < WITH_WIDTH(width)) + /* need at least 3 chars left for get_rel_pos() + NUL */ + while (this_ru_col + o < WITH_WIDTH(width) && RULER_BUF_LEN > i + 4) { #ifdef FEAT_MBYTE if (has_mbyte) diff --git a/src/version.c b/src/version.c index 9d06ab33f..5c7dbd91f 100644 --- a/src/version.c +++ b/src/version.c @@ -742,6 +742,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 562, +/**/ 561, /**/ 560, |