Patch 8.0.1397
Problem: Pattern with \& following nothing gives an error.
Solution: Emit an empty node when needed.
Files: src/regexp_nfa.c, src/testdir/test_search.vim
*** ../vim-8.0.1396/src/regexp_nfa.c 2017-11-02 22:29:32.840234120 +0100
--- src/regexp_nfa.c 2017-12-16 19:41:41.959367391 +0100
***************
*** 2321,2327 ****
static int
nfa_regbranch(void)
{
- int ch;
int old_post_pos;
old_post_pos = (int)(post_ptr - post_start);
--- 2321,2326 ----
***************
*** 2330,2340 ****
if (nfa_regconcat() == FAIL)
return FAIL;
- ch = peekchr();
/* Try next concats */
! while (ch == Magic('&'))
{
skipchr();
EMIT(NFA_NOPEN);
EMIT(NFA_PREV_ATOM_NO_WIDTH);
old_post_pos = (int)(post_ptr - post_start);
--- 2329,2341 ----
if (nfa_regconcat() == FAIL)
return FAIL;
/* Try next concats */
! while (peekchr() == Magic('&'))
{
skipchr();
+ /* if concat is empty do emit a node */
+ if (old_post_pos == (int)(post_ptr - post_start))
+ EMIT(NFA_EMPTY);
EMIT(NFA_NOPEN);
EMIT(NFA_PREV_ATOM_NO_WIDTH);
old_post_pos = (int)(post_ptr - post_start);
***************
*** 2344,2350 ****
if (old_post_pos == (int)(post_ptr - post_start))
EMIT(NFA_EMPTY);
EMIT(NFA_CONCAT);
- ch = peekchr();
}
/* if a branch is empty, emit one node for it */
--- 2345,2350 ----
*** ../vim-8.0.1396/src/testdir/test_search.vim 2017-11-16 22:20:35.028615026
+0100
--- src/testdir/test_search.vim 2017-12-16 19:44:15.446234134 +0100
***************
*** 721,723 ****
--- 721,731 ----
enew!
let &encoding = save_enc
endfunc
+
+ " This was causing E874. Also causes an invalid read?
+ func Test_look_behind()
+ new
+ call setline(1, '0\|\&\n\@<=')
+ call search(getline("."))
+ bwipe!
+ endfunc
*** ../vim-8.0.1396/src/version.c 2017-12-16 19:05:18.246528820 +0100
--- src/version.c 2017-12-16 19:43:28.750576811 +0100
***************
*** 773,774 ****
--- 773,776 ----
{ /* Add new patch number below this line */
+ /**/
+ 1397,
/**/
--
Corduroy pillows: They're making headlines!
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
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].
For more options, visit https://groups.google.com/d/optout.