dcaee6
To: vim_dev@googlegroups.com
dcaee6
Subject: Patch 7.4.051
dcaee6
Fcc: outbox
dcaee6
From: Bram Moolenaar <Bram@moolenaar.net>
dcaee6
Mime-Version: 1.0
dcaee6
Content-Type: text/plain; charset=UTF-8
dcaee6
Content-Transfer-Encoding: 8bit
dcaee6
------------
dcaee6
dcaee6
Patch 7.4.051
dcaee6
Problem:    Syntax highlighting a Yaml file causes a crash. (Blake Preston)
dcaee6
Solution:   Copy the pim structure before calling addstate() to avoid it
dcaee6
	    becoming invalide when the state list is reallocated.
dcaee6
Files:	    src/regexp_nfa.c
dcaee6
dcaee6
dcaee6
*** ../vim-7.4.050/src/regexp_nfa.c	2013-09-25 18:16:34.000000000 +0200
dcaee6
--- src/regexp_nfa.c	2013-10-06 15:44:31.000000000 +0200
dcaee6
***************
dcaee6
*** 6458,6463 ****
dcaee6
--- 6458,6464 ----
dcaee6
  	    if (add_state != NULL)
dcaee6
  	    {
dcaee6
  		nfa_pim_T *pim;
dcaee6
+ 		nfa_pim_T pim_copy;
dcaee6
  
dcaee6
  		if (t->pim.result == NFA_PIM_UNUSED)
dcaee6
  		    pim = NULL;
dcaee6
***************
dcaee6
*** 6531,6536 ****
dcaee6
--- 6532,6546 ----
dcaee6
  		    pim = NULL;
dcaee6
  		}
dcaee6
  
dcaee6
+ 		/* If "pim" points into l->t it will become invalid when
dcaee6
+ 		 * adding the state causes the list to be reallocated.  Make a
dcaee6
+ 		 * local copy to avoid that. */
dcaee6
+ 		if (pim == &t->pim)
dcaee6
+ 		{
dcaee6
+ 		    copy_pim(&pim_copy, pim);
dcaee6
+ 		    pim = &pim_copy;
dcaee6
+ 		}
dcaee6
+ 
dcaee6
  		if (add_here)
dcaee6
  		    addstate_here(thislist, add_state, &t->subs, pim, &listidx);
dcaee6
  		else
dcaee6
*** ../vim-7.4.050/src/version.c	2013-10-02 21:54:57.000000000 +0200
dcaee6
--- src/version.c	2013-10-06 15:21:16.000000000 +0200
dcaee6
***************
dcaee6
*** 740,741 ****
dcaee6
--- 740,743 ----
dcaee6
  {   /* Add new patch number below this line */
dcaee6
+ /**/
dcaee6
+     51,
dcaee6
  /**/
dcaee6
dcaee6
-- 
dcaee6
GUARD #2:  It could be carried by an African swallow!
dcaee6
GUARD #1:  Oh, yeah, an African swallow maybe, but not a European swallow,
dcaee6
           that's my point.
dcaee6
GUARD #2:  Oh, yeah, I agree with that...
dcaee6
                                  The Quest for the Holy Grail (Monty Python)
dcaee6
dcaee6
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
dcaee6
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
dcaee6
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
dcaee6
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///