To: vim-dev@vim.org
Subject: Patch 7.1.315
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------
Patch 7.1.315
Problem: Crash with specific search pattern using look-behind match.
(Andreas Politz)
Solution: Also save the value of "need_clear_subexpr".
Files: src/regexp.c
*** ../vim-7.1.314/src/regexp.c Wed Apr 9 12:14:44 2008
--- src/regexp.c Sun Jun 15 14:16:40 2008
***************
*** 3044,3049 ****
--- 3044,3050 ----
{
regsave_T save_after;
regsave_T save_behind;
+ int save_need_clear_subexpr;
save_se_T save_start[NSUBEXP];
save_se_T save_end[NSUBEXP];
} regbehind_T;
***************
*** 5858,5874 ****
{
int i;
! for (i = 0; i < NSUBEXP; ++i)
{
! if (REG_MULTI)
! {
! bp->save_start[i].se_u.pos = reg_startpos[i];
! bp->save_end[i].se_u.pos = reg_endpos[i];
! }
! else
{
! bp->save_start[i].se_u.ptr = reg_startp[i];
! bp->save_end[i].se_u.ptr = reg_endp[i];
}
}
}
--- 5859,5881 ----
{
int i;
! /* When "need_clear_subexpr" is set we don't need to save the values, only
! * remember that this flag needs to be set again when restoring. */
! bp->save_need_clear_subexpr = need_clear_subexpr;
! if (!need_clear_subexpr)
{
! for (i = 0; i < NSUBEXP; ++i)
{
! if (REG_MULTI)
! {
! bp->save_start[i].se_u.pos = reg_startpos[i];
! bp->save_end[i].se_u.pos = reg_endpos[i];
! }
! else
! {
! bp->save_start[i].se_u.ptr = reg_startp[i];
! bp->save_end[i].se_u.ptr = reg_endp[i];
! }
}
}
}
***************
*** 5882,5898 ****
{
int i;
! for (i = 0; i < NSUBEXP; ++i)
{
! if (REG_MULTI)
! {
! reg_startpos[i] = bp->save_start[i].se_u.pos;
! reg_endpos[i] = bp->save_end[i].se_u.pos;
! }
! else
{
! reg_startp[i] = bp->save_start[i].se_u.ptr;
! reg_endp[i] = bp->save_end[i].se_u.ptr;
}
}
}
--- 5889,5910 ----
{
int i;
! /* Only need to restore saved values when they are not to be cleared. */
! need_clear_subexpr = bp->save_need_clear_subexpr;
! if (!need_clear_subexpr)
{
! for (i = 0; i < NSUBEXP; ++i)
{
! if (REG_MULTI)
! {
! reg_startpos[i] = bp->save_start[i].se_u.pos;
! reg_endpos[i] = bp->save_end[i].se_u.pos;
! }
! else
! {
! reg_startp[i] = bp->save_start[i].se_u.ptr;
! reg_endp[i] = bp->save_end[i].se_u.ptr;
! }
}
}
}
*** ../vim-7.1.314/src/version.c Mon Jun 9 17:07:13 2008
--- src/version.c Sun Jun 15 14:12:54 2008
***************
*** 668,669 ****
--- 673,676 ----
{ /* Add new patch number below this line */
+ /**/
+ 315,
/**/
--
Tips for aliens in New York: Land anywhere. Central Park, anywhere.
No one will care or indeed even notice.
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///