summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-12-02 16:39:44 +0000
committerBram Moolenaar <Bram@vim.org>2022-12-02 16:39:44 +0000
commitc67c89c7589253215d57bad588edcf83a9403560 (patch)
tree1125e11fda971572669020d565ed5c872d75130b
parentc96b7f5d2af241c5eb1589e9da3dc09e45355e65 (diff)
downloadvim-git-c67c89c7589253215d57bad588edcf83a9403560.tar.gz
patch 9.0.0991: crash when reading help index with various options setv9.0.0991
Problem: Crash when reading help index with various options set. (Marius Gedminas) Solution: Do not set wlv.c_extra to NUL when wlv.p_extra is NULL. (closes #11651)
-rw-r--r--src/drawline.c16
-rw-r--r--src/testdir/test_breakindent.vim18
-rw-r--r--src/version.c2
3 files changed, 29 insertions, 7 deletions
diff --git a/src/drawline.c b/src/drawline.c
index d0a4cc15e..e2849a1ff 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -2894,10 +2894,10 @@ win_line(
// into "ScreenLines".
if (c == TAB && (!wp->w_p_list || wp->w_lcs_chars.tab1))
{
- int tab_len = 0;
- long vcol_adjusted = wlv.vcol; // removed showbreak length
+ int tab_len = 0;
+ long vcol_adjusted = wlv.vcol; // removed showbreak len
#ifdef FEAT_LINEBREAK
- char_u *sbr = get_showbreak_value(wp);
+ char_u *sbr = get_showbreak_value(wp);
// only adjust the tab_len, when at the first column
// after the showbreak value was drawn
@@ -2917,8 +2917,10 @@ win_line(
#ifdef FEAT_LINEBREAK
if (!wp->w_p_lbr || !wp->w_p_list)
#endif
+ {
// tab amount depends on current column
wlv.n_extra = tab_len;
+ }
#ifdef FEAT_LINEBREAK
else
{
@@ -2940,9 +2942,9 @@ win_line(
# endif
if (tab_len > 0)
{
- // If wlv.n_extra > 0, it gives the number of
- // chars, to use for a tab, else we need to
- // calculate the width for a tab.
+ // If wlv.n_extra > 0, it gives the number of chars
+ // to use for a tab, else we need to calculate the
+ // width for a tab.
int tab2_len = mb_char2len(wp->w_lcs_chars.tab2);
len = tab_len * tab2_len;
if (wp->w_lcs_chars.tab3)
@@ -3018,7 +3020,7 @@ win_line(
? wp->w_lcs_chars.tab3
: wp->w_lcs_chars.tab1;
#ifdef FEAT_LINEBREAK
- if (wp->w_p_lbr)
+ if (wp->w_p_lbr && wlv.p_extra != NULL)
wlv.c_extra = NUL; // using p_extra from above
else
#endif
diff --git a/src/testdir/test_breakindent.vim b/src/testdir/test_breakindent.vim
index 9719c3d0a..27b1d9847 100644
--- a/src/testdir/test_breakindent.vim
+++ b/src/testdir/test_breakindent.vim
@@ -1034,4 +1034,22 @@ func Test_breakindent_column()
bwipeout!
endfunc
+func Test_linebreak_list()
+ " This was setting wlv.c_extra to NUL while wlv.p_extra is NULL
+ filetype plugin on
+ syntax enable
+ edit! $VIMRUNTIME/doc/index.txt
+ /v_P
+
+ setlocal list
+ setlocal listchars=tab:>-
+ setlocal linebreak
+ setlocal nowrap
+ setlocal filetype=help
+ redraw!
+
+ bwipe!
+endfunc
+
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index f9b1e6c22..07a609364 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 991,
+/**/
990,
/**/
989,