if (wp == NULL)
{
// Fill the TabPageIdxs[] array for clicking in the tab pagesline.
+ int end_col = firstwin->w_wincol + topframe->fr_width;
+ if (end_col > Columns)
+ end_col = Columns;
col = firstwin->w_wincol;
len = 0;
p = buf;
for (n = 0; tabtab[n].start != NULL; n++)
{
len += vim_strnsize(p, (int)(tabtab[n].start - p));
- while (col < len)
+ while (col < len && col < end_col)
TabPageIdxs[col++] = fillchar;
+ if (col >= end_col)
+ break;
p = tabtab[n].start;
fillchar = tabtab[n].userhl;
}
- while (col < firstwin->w_wincol + topframe->fr_width)
+ while (col < end_col)
TabPageIdxs[col++] = fillchar;
}
call RunVim([], [], "-e -s -S Xclickscript -c qa")
endfunc
+func Test_tabline_TabPageIdxs_overflow()
+ " Regression: TabPageIdxs[] overflow when closing a tab with custom
+ " 'tabline' and showtabpanel=1 (firstwin->w_wincol + topframe->fr_width
+ " could exceed Columns).
+ CheckFeature tabpanel
+ let before = [
+ \ 'set showtabpanel=1',
+ \ 'set tabline=foo',
+ \ 'call feedkeys(":qa!\<CR>")',
+ \ ]
+ call RunVim(before, [], '-p Xtabline_overflow_a Xtabline_overflow_b')
+ call assert_equal(0, v:shell_error, 'Vim subprocess must not crash (TabPageIdxs overflow)')
+endfunc
+
func Test_tabline_showcmd()
CheckScreendump