Patch 9.0.0527
Problem: Long sign text may overflow buffer.
Solution: Use a larger buffer. Prevent for overflow.
Files: src/drawline.c, src/testdir/test_signs.vim
*** ../vim-9.0.0526/src/drawline.c 2022-09-20 21:09:38.317219912 +0100
--- src/drawline.c 2022-09-21 11:17:12.219393393 +0100
***************
*** 124,130 ****
int saved_c_final;
int saved_char_attr;
! char_u extra[21]; // "%ld " and 'fdc' must fit in here
#ifdef FEAT_DIFF
hlf_T diff_hlf; // type of diff highlighting
--- 124,132 ----
int saved_c_final;
int saved_char_attr;
! char_u extra[NUMBUFLEN + MB_MAXBYTES];
! // "%ld " and 'fdc' must fit in here, as well
! // any text sign
#ifdef FEAT_DIFF
hlf_T diff_hlf; // type of diff highlighting
***************
*** 259,271 ****
{
if (nrcol)
{
! int n, width = number_width(wp) - 2;
for (n = 0; n < width; n++)
wlv->extra[n] = ' ';
! wlv->extra[n] = 0;
! STRCAT(wlv->extra, wlv->p_extra);
! STRCAT(wlv->extra, " ");
wlv->p_extra = wlv->extra;
}
wlv->c_extra = NUL;
--- 261,273 ----
{
if (nrcol)
{
! int width = number_width(wp) - 2;
! int n;
for (n = 0; n < width; n++)
wlv->extra[n] = ' ';
! vim_snprintf((char *)wlv->extra + n,
! sizeof(wlv->extra) - n, "%s ", wlv->p_extra);
wlv->p_extra = wlv->extra;
}
wlv->c_extra = NUL;
*** ../vim-9.0.0526/src/testdir/test_signs.vim 2022-09-02 15:15:11.063569185 +0100
--- src/testdir/test_signs.vim 2022-09-21 11:19:43.766868832 +0100
***************
*** 196,201 ****
--- 196,215 ----
\ bufnr('%'), 'E155:')
endfunc
+ func Test_sign_many_bytes()
+ new
+ set signcolumn=number
+ set number
+ call setline(1, 'some text')
+ " composing characters can use many bytes, check for overflow
+ sign define manyBytes text=▶᷄᷅᷆◀᷄᷅᷆᷇
+ sign place 17 line=1 name=manyBytes
+ redraw
+
+ bwipe!
+ sign undefine manyBytes
+ endfunc
+
" Undefining placed sign is not recommended.
" Quoting :help sign
"
*** ../vim-9.0.0526/src/version.c 2022-09-21 10:51:09.052577433 +0100
--- src/version.c 2022-09-21 11:18:47.611061322 +0100
***************
*** 701,702 ****
--- 701,704 ----
{ /* Add new patch number below this line */
+ /**/
+ 527,
/**/
--
"A clear conscience is usually the sign of a bad memory."
-- Steven Wright
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///