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 -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202109071728.187HS6jk1675091%40masaka.moolenaar.net.