|
|
a72edb |
From 34f8117dec685ace52cd9e578e2729db278163fc Mon Sep 17 00:00:00 2001
|
|
|
a72edb |
From: Bram Moolenaar <Bram@vim.org>
|
|
|
a72edb |
Date: Wed, 16 Feb 2022 12:16:19 +0000
|
|
|
a72edb |
Subject: [PATCH] patch 8.2.4397: crash when using many composing characters in
|
|
|
a72edb |
error message
|
|
|
a72edb |
|
|
|
a72edb |
Problem: Crash when using many composing characters in error message.
|
|
|
a72edb |
Solution: Use mb_cptr2char_adv() instead of mb_ptr2char_adv().
|
|
|
a72edb |
---
|
|
|
a72edb |
src/testdir/test_assert.vim | 8 ++++++++
|
|
|
a72edb |
src/testing.c | 2 +-
|
|
|
a72edb |
src/version.c | 2 ++
|
|
|
a72edb |
3 files changed, 11 insertions(+), 1 deletion(-)
|
|
|
a72edb |
|
|
|
a72edb |
diff --git a/src/testdir/test_assert.vim b/src/testdir/test_assert.vim
|
|
|
a72edb |
index 8987f3f8d..27b2d73fb 100644
|
|
|
a72edb |
--- a/src/testdir/test_assert.vim
|
|
|
a72edb |
+++ b/src/testdir/test_assert.vim
|
|
|
a72edb |
@@ -53,6 +53,14 @@ func Test_assert_equal()
|
|
|
a72edb |
call assert_equal("\b\e\f\n\t\r\\\x01\x7f", 'x')
|
|
|
a72edb |
call assert_match('Expected ''\\b\\e\\f\\n\\t\\r\\\\\\x01\\x7f'' but got ''x''', v:errors[0])
|
|
|
a72edb |
call remove(v:errors, 0)
|
|
|
a72edb |
+
|
|
|
a72edb |
+ " many composing characters are handled properly
|
|
|
a72edb |
+ call setline(1, ' ')
|
|
|
a72edb |
+ norm 100grƯ€
|
|
|
a72edb |
+ call assert_equal(1, getline(1))
|
|
|
a72edb |
+ call assert_match("Expected 1 but got '.* occurs 100 times]'", v:errors[0])
|
|
|
a72edb |
+ call remove(v:errors, 0)
|
|
|
a72edb |
+ bwipe!
|
|
|
a72edb |
endfunc
|
|
|
a72edb |
|
|
|
a72edb |
func Test_assert_equal_dict()
|
|
|
a72edb |
diff --git a/src/testing.c b/src/testing.c
|
|
|
a72edb |
index 448c01c1e..48ba14d2c 100644
|
|
|
a72edb |
--- a/src/testing.c
|
|
|
a72edb |
+++ b/src/testing.c
|
|
|
a72edb |
@@ -101,7 +101,7 @@ ga_concat_shorten_esc(garray_T *gap, char_u *str)
|
|
|
a72edb |
{
|
|
|
a72edb |
same_len = 1;
|
|
|
a72edb |
s = p;
|
|
|
a72edb |
- c = mb_ptr2char_adv(&s);
|
|
|
a72edb |
+ c = mb_cptr2char_adv(&s);
|
|
|
a72edb |
clen = s - p;
|
|
|
a72edb |
while (*s != NUL && c == mb_ptr2char(s))
|
|
|
a72edb |
{
|
|
|
a72edb |
--
|
|
|
a72edb |
2.35.1
|
|
|
a72edb |
|