bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23869: 25.0.95; replace-match can crash emacs


From: Eli Zaretskii
Subject: bug#23869: 25.0.95; replace-match can crash emacs
Date: Sun, 03 Jul 2016 23:33:05 +0300

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Leo Liu <sdl.web@gmail.com>,  23869@debbugs.gnu.org
> Date: Sun, 03 Jul 2016 16:08:10 -0400
> 
> > +  /* The functions below modify the buffer, so they could trigger
> > +     various modification hooks (see signal_before_change and
> > +     signal_after_change), which might clobber the match data we need
> > +     to adjust after the replacement.  So we save and restore the
> > +     match data around the calls.  */
> > +  ptrdiff_t sub_start = search_regs.start[sub];
> > +  ptrdiff_t sub_end = search_regs.end[sub];
> > +  save_search_regs ();
> 
> I think it's important to avoid a crash, but it's not important to
> behave correctly even if the change-hooks modifying the match data.
> So if we can find a simpler/cheaper way to avoid the crash, it'd
> be preferable.

The only alternative I'm aware of is to detect the clobbering and
error out, as the patch I proposed does as "last line of defense".  Is
that what you had in mind?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]