To: vim_dev@googlegroups.com Subject: Patch 8.2.3850 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3850 Problem: Illegal memory access when displaying a partial. Solution: Terminate the string with a NUL. (closes #9371) Files: src/eval.c, src/testdir/test_messages.vim *** ../vim-8.2.3849/src/eval.c 2021-12-18 16:54:28.363950392 +0000 --- src/eval.c 2021-12-19 11:03:55.286931675 +0000 *************** *** 5087,5093 **** ga_concat(&ga, tv2string(&dtv, &tf, numbuf, copyID)); vim_free(tf); } ! ga_concat(&ga, (char_u *)")"); *tofree = ga.ga_data; r = *tofree; --- 5087,5094 ---- ga_concat(&ga, tv2string(&dtv, &tf, numbuf, copyID)); vim_free(tf); } ! // terminate with ')' and a NUL ! ga_concat_len(&ga, (char_u *)")", 2); *tofree = ga.ga_data; r = *tofree; *** ../vim-8.2.3849/src/testdir/test_messages.vim 2021-03-15 17:36:16.725494781 +0000 --- src/testdir/test_messages.vim 2021-12-19 11:02:00.867282444 +0000 *************** *** 337,340 **** --- 337,347 ---- call delete('Xtest_quit_message') endfunc + " this was missing a terminating NUL + func Test_echo_string_partial() + function CountSpaces() + endfunction + echomsg function('CountSpaces', [#{aaaaaaaaaaa: v:false, bbbbbbbbbbbb: '', ccccccccccc: ['ab', 'cd']}]) + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.3849/src/version.c 2021-12-19 10:35:10.704109718 +0000 --- src/version.c 2021-12-19 11:06:10.002524275 +0000 *************** *** 751,752 **** --- 751,754 ---- { /* Add new patch number below this line */ + /**/ + 3850, /**/ -- Proof techniques #2: Proof by Oddity. SAMPLE: To prove that horses have an infinite number of legs. (1) Horses have an even number of legs. (2) They have two legs in back and fore legs in front. (3) This makes a total of six legs, which certainly is an odd number of legs for a horse. (4) But the only number that is both odd and even is infinity. (5) Therefore, horses must have an infinite number of legs. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///