1
0
Fork 0
mirror of https://github.com/vim/vim synced 2025-03-30 06:26:45 +02:00

patch 8.2.4397: crash when using many composing characters in error message

Problem:    Crash when using many composing characters in error message.
Solution:   Use mb_cptr2char_adv() instead of mb_ptr2char_adv().
This commit is contained in:
Bram Moolenaar 2022-02-16 12:16:19 +00:00
parent f5288c5895
commit 34f8117dec
3 changed files with 11 additions and 1 deletions

View file

@ -53,6 +53,14 @@ func Test_assert_equal()
call assert_equal("\b\e\f\n\t\r\\\x01\x7f", 'x')
call assert_match('Expected ''\\b\\e\\f\\n\\t\\r\\\\\\x01\\x7f'' but got ''x''', v:errors[0])
call remove(v:errors, 0)
" many composing characters are handled properly
call setline(1, ' ')
norm 100gr݀
call assert_equal(1, getline(1))
call assert_match("Expected 1 but got '.* occurs 100 times]'", v:errors[0])
call remove(v:errors, 0)
bwipe!
endfunc
func Test_assert_equal_dict()

View file

@ -101,7 +101,7 @@ ga_concat_shorten_esc(garray_T *gap, char_u *str)
{
same_len = 1;
s = p;
c = mb_ptr2char_adv(&s);
c = mb_cptr2char_adv(&s);
clen = s - p;
while (*s != NUL && c == mb_ptr2char(s))
{

View file

@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4397,
/**/
4396,
/**/