To: vim_dev@googlegroups.com Subject: Patch 8.2.0824 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0824 (after 8.2.0817) Problem: Still not enough memory allocated when converting string with special character. Solution: Reserve space for expanding K_SPECIAL. (closes #6130) Files: src/eval.c, src/testdir/test_functions.vim *** ../vim-8.2.0823/src/eval.c 2020-05-24 23:00:06.440196016 +0200 --- src/eval.c 2020-05-25 22:55:02.354536931 +0200 *************** *** 3515,3524 **** { ++p; // A "\" form occupies at least 4 characters, and produces up ! // to 9 characters (6 for the char and 3 for a modifier): reserve ! // space for 5 extra. if (*p == '<') ! extra += 5; } } --- 3515,3525 ---- { ++p; // A "\" form occupies at least 4 characters, and produces up ! // to 21 characters (3 * 6 for the char and 3 for a modifier): ! // reserve space for 18 extra. ! // Each byte in the char could be encoded as K_SPECIAL K_EXTRA x. if (*p == '<') ! extra += 18; } } *** ../vim-8.2.0823/src/testdir/test_functions.vim 2020-05-24 18:45:04.083820033 +0200 --- src/testdir/test_functions.vim 2020-05-25 23:00:06.725658239 +0200 *************** *** 2280,2285 **** --- 2280,2286 ---- call assert_equal('a', nr2char(97, 0)) call assert_equal("\x80\xfc\b\xf4\x80\xfeX\x80\xfeX\x80\xfeX", eval('"\"')) + call assert_equal("\x80\xfc\b\xfd\x80\xfeX\x80\xfeX\x80\xfeX\x80\xfeX\x80\xfeX", eval('"\"')) endfunc " Test for screenattr(), screenchar() and screenchars() functions *** ../vim-8.2.0823/src/version.c 2020-05-25 22:36:46.629735032 +0200 --- src/version.c 2020-05-25 23:01:07.389483674 +0200 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 824, /**/ -- hundred-and-one symptoms of being an internet addict: 177. You log off of your system because it's time to go to work. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///