To: vim_dev@googlegroups.com Subject: Patch 8.2.2078 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2078 Problem: Illegal memory access when using :print on invalid text. (Dhiraj Mishra) Solution: Check for more composing characters than supported. (closes #7399) Files: src/message.c, src/testdir/test_utf8.vim *** ../vim-8.2.2077/src/message.c 2020-10-28 20:19:56.372057081 +0100 --- src/message.c 2020-12-02 12:33:05.899862645 +0100 *************** *** 1859,1865 **** else if (has_mbyte && (l = (*mb_ptr2len)(s)) > 1) { col += (*mb_ptr2cells)(s); ! if (lcs_nbsp != NUL && list && (mb_ptr2char(s) == 160 || mb_ptr2char(s) == 0x202f)) { --- 1859,1869 ---- else if (has_mbyte && (l = (*mb_ptr2len)(s)) > 1) { col += (*mb_ptr2cells)(s); ! if (l >= MB_MAXBYTES) ! { ! STRCPY(buf, "¿"); ! } ! else if (lcs_nbsp != NUL && list && (mb_ptr2char(s) == 160 || mb_ptr2char(s) == 0x202f)) { *** ../vim-8.2.2077/src/testdir/test_utf8.vim 2020-09-06 17:13:40.801413710 +0200 --- src/testdir/test_utf8.vim 2020-12-02 12:29:16.036639463 +0100 *************** *** 180,183 **** --- 180,192 ---- call assert_fails('call setcellwidths([[0x33, 0x44, 2]])', 'E1114:') endfunc + func Test_print_overlong() + " Text with more composing characters than MB_MAXBYTES. + new + call setline(1, 'axxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') + s/x/\=nr2char(1629)/g + print + bwipe! + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.2077/src/version.c 2020-12-01 21:47:55.156840720 +0100 --- src/version.c 2020-12-02 12:30:32.296392550 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2078, /**/ -- CRONE: Who sent you? ARTHUR: The Knights Who Say Ni! CRONE: Aaaagh! (she looks around in rear) No! We have no shrubberies here. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///