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