Patch 8.2.3409

5 views
Skip to first unread message

Bram Moolenaar

unread,
Sep 7, 2021, 1:28:16 PM9/7/21
to vim...@googlegroups.com

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 -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages