0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 7.4.2068

Problem:    Not all arguments of trunc_string() are tested.  Memory access
            error when running the message tests.
Solution:   Add another test case. (Yegappan Lakshmanan)  Make it easy to run
            unittests with valgrind.  Fix the access error.
This commit is contained in:
Bram Moolenaar
2016-07-19 12:33:44 +02:00
parent 16ec3c9be3
commit b9644433d2
4 changed files with 50 additions and 14 deletions

View File

@@ -298,9 +298,9 @@ trunc_string(
{
do
half = half - (*mb_head_off)(s, s + half - 1) - 1;
while (utf_iscomposing(utf_ptr2char(s + half)) && half > 0);
while (half > 0 && utf_iscomposing(utf_ptr2char(s + half)));
n = ptr2cells(s + half);
if (len + n > room)
if (len + n > room || half == 0)
break;
len += n;
i = half;