To: vim_dev@googlegroups.com Subject: Patch 8.2.3409 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3409 Problem: Reading beyond end of line with invalid utf-8 character. Solution: Check for NUL when advancing. Files: src/regexp_nfa.c, src/testdir/test_regexp_utf8.vim *** ../vim-8.2.3408/src/regexp_nfa.c 2021-07-21 22:20:30.066401728 +0200 --- src/regexp_nfa.c 2021-09-07 19:24:06.039196689 +0200 *************** *** 5664,5670 **** match = FALSE; break; } ! len2 += MB_CHAR2LEN(c2); } if (match // check that no composing char follows --- 5664,5671 ---- match = FALSE; break; } ! len2 += enc_utf8 ? utf_ptr2len(rex.line + col + len2) ! : MB_CHAR2LEN(c2); } if (match // check that no composing char follows *** ../vim-8.2.3408/src/testdir/test_regexp_utf8.vim 2021-04-05 13:59:48.720005966 +0200 --- src/testdir/test_regexp_utf8.vim 2021-09-07 19:23:28.923312048 +0200 *************** *** 558,561 **** --- 558,569 ---- bwipe! endfunc + func Test_match_invalid_byte() + call writefile(0z630a.765d30aa0a.2e0a.790a.4030, 'Xinvalid') + new + source Xinvalid + bwipe! + call delete('Xinvalid') + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.3408/src/version.c 2021-09-06 20:56:53.296274317 +0200 --- src/version.c 2021-09-07 18:05:04.780241651 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3409, /**/ -- A)bort, R)etry, D)o it right this time /// 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 ///