File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2321,7 +2321,6 @@ nfa_regconcat(void)
23212321 static int
23222322nfa_regbranch (void )
23232323{
2324- int ch ;
23252324 int old_post_pos ;
23262325
23272326 old_post_pos = (int )(post_ptr - post_start );
@@ -2330,11 +2329,13 @@ nfa_regbranch(void)
23302329 if (nfa_regconcat () == FAIL )
23312330 return FAIL ;
23322331
2333- ch = peekchr ();
23342332 /* Try next concats */
2335- while (ch == Magic ('&' ))
2333+ while (peekchr () == Magic ('&' ))
23362334 {
23372335 skipchr ();
2336+ /* if concat is empty do emit a node */
2337+ if (old_post_pos == (int )(post_ptr - post_start ))
2338+ EMIT (NFA_EMPTY );
23382339 EMIT (NFA_NOPEN );
23392340 EMIT (NFA_PREV_ATOM_NO_WIDTH );
23402341 old_post_pos = (int )(post_ptr - post_start );
@@ -2344,7 +2345,6 @@ nfa_regbranch(void)
23442345 if (old_post_pos == (int )(post_ptr - post_start ))
23452346 EMIT (NFA_EMPTY );
23462347 EMIT (NFA_CONCAT );
2347- ch = peekchr ();
23482348 }
23492349
23502350 /* if a branch is empty, emit one node for it */
Original file line number Diff line number Diff line change @@ -721,3 +721,11 @@ func Test_search_multibyte()
721721 enew !
722722 let &encoding = save_enc
723723endfunc
724+
725+ " This was causing E874. Also causes an invalid read?
726+ func Test_look_behind ()
727+ new
728+ call setline (1 , ' 0\|\&\n\@<=' )
729+ call search (getline (" ." ))
730+ bwipe!
731+ endfunc
Original file line number Diff line number Diff line change @@ -771,6 +771,8 @@ static char *(features[]) =
771771
772772static int included_patches [] =
773773{ /* Add new patch number below this line */
774+ /**/
775+ 1397 ,
774776/**/
775777 1396 ,
776778/**/
You can’t perform that action at this time.
0 commit comments