# HG changeset patch # User Bram Moolenaar # Date 1645014605 -3600 # Node ID 3b2c75c0a7ab43e69758be99b1f2538ef4ca57c7 # Parent c3d762e7b5ce78a1974f5ab86ad73f4ca0400d05 patch 8.2.4397: crash when using many composing characters in error message Commit: https://github.com/vim/vim/commit/34f8117dec685ace52cd9e578e2729db278163fc Author: Bram Moolenaar Date: Wed Feb 16 12:16:19 2022 +0000 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(). diff --git a/src/testdir/test_assert.vim b/src/testdir/test_assert.vim --- a/src/testdir/test_assert.vim +++ b/src/testdir/test_assert.vim @@ -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() diff --git a/src/testing.c b/src/testing.c --- a/src/testing.c +++ b/src/testing.c @@ -101,7 +101,7 @@ ga_concat_shorten_esc(garray_T *gap, cha { 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)) { diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4397, +/**/ 4396, /**/ 4395,