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