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