comparison src/message.c @ 9581:716382aaa0c0 v7.4.2068

commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jul 19 12:33:44 2016 +0200 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.
author Christian Brabandt <cb@256bit.org>
date Tue, 19 Jul 2016 12:45:05 +0200
parents 00ee8d8c2e0c
children 846d4bad2df7
comparison
equal deleted inserted replaced
9580:624a90bf4f05 9581:716382aaa0c0
296 half = i = (int)STRLEN(s); 296 half = i = (int)STRLEN(s);
297 for (;;) 297 for (;;)
298 { 298 {
299 do 299 do
300 half = half - (*mb_head_off)(s, s + half - 1) - 1; 300 half = half - (*mb_head_off)(s, s + half - 1) - 1;
301 while (utf_iscomposing(utf_ptr2char(s + half)) && half > 0); 301 while (half > 0 && utf_iscomposing(utf_ptr2char(s + half)));
302 n = ptr2cells(s + half); 302 n = ptr2cells(s + half);
303 if (len + n > room) 303 if (len + n > room || half == 0)
304 break; 304 break;
305 len += n; 305 len += n;
306 i = half; 306 i = half;
307 } 307 }
308 } 308 }