unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Leo Liu <sdl.web@gmail.com>, 23869@debbugs.gnu.org
Subject: bug#23869: 25.0.95; replace-match can crash emacs
Date: Sun, 03 Jul 2016 16:08:10 -0400	[thread overview]
Message-ID: <jwvshvqa3ml.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <83twgavhua.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 30 Jun 2016 18:04:13 +0300")

> Morale: a buffer-modification hook should always save-match-data.

Indeed.  If it does modify the match data, it's a bug in that hook function.

> +  /* 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.


        Stefan





  parent reply	other threads:[~2016-07-03 20:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-29 14:17 bug#23869: 25.0.95; replace-match can crash emacs Leo Liu
2016-06-29 15:37 ` Eli Zaretskii
2016-06-29 16:00   ` Leo Liu
2016-06-29 16:07     ` Eli Zaretskii
2016-06-30  3:27       ` Leo Liu
2016-06-30 15:04         ` Eli Zaretskii
2016-07-03 18:53           ` Leo Liu
2016-07-03 19:32             ` Eli Zaretskii
2016-07-03 20:08           ` Stefan Monnier [this message]
2016-07-03 20:33             ` Eli Zaretskii
2016-07-03 21:06               ` Stefan Monnier
2016-07-04 15:36                 ` Eli Zaretskii
2016-07-06 14:32                   ` Robert Pluim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvshvqa3ml.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=23869@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=sdl.web@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).