From: Chong Yidong <cyd@stupidchicken.com>
To: emacs-devel@gnu.org
Cc: 8219@debbugs.gnu.org
Subject: Effect of deletions on indirect buffers (Bug#8219)
Date: Fri, 11 Mar 2011 14:48:21 -0500 [thread overview]
Message-ID: <877hc5bfqy.fsf@stupidchicken.com> (raw)
Indirect bufffers are allowed to have their own values of point,
BUF_BEGV, and BUF_ZV (indeed, that's one of their roles). Their other
attributes inherit from the base buffer, e.g.
#define BUF_Z(buf) ((buf)->text->z)
where `text' points to the base buffer's text object.
Now consider what happens when a deletion is performed in buffer A,
which is the base buffer for an indirect buffer B. It appears that the
responsible functions, such as del_range_2, only update the attributes
of buffer A, making no effort to update buffer B.
Hence, in the aftermath of a deletion, buffer B's values of PT (and
BUF_BEGV and BUF_ZV) can be larger than BUF_ZV. This is the proximate
cause of the crash in Bug#8219: there, we have
if (prev_pt > BUF_BEGV (buf) && prev_pt < BUF_ZV (buf)
&& find_composition (prev_pt, -1, &start, &end, &prop, buffer)
and find_composition aborts because prev_pt is larger than the size of
the buffer.
I'm not sure what the best solution is. The narrowest fix is to change
find_composition, and the functions it calls, so that it does not abort
when supplied with a position that's beyond BUF_Z. This might be the
best approach for the emacs-23 branch.
However, I suspect that we have other places in the code that assumes
that if a point is smaller than BUF_ZV, it's necessarily smaller than
BUF_Z---which we now see if not that case. So, a more comprehensive fix
is needed for the trunk.
Any thoughts?
next reply other threads:[~2011-03-11 19:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-11 19:48 Chong Yidong [this message]
2011-03-11 20:07 ` Effect of deletions on indirect buffers (Bug#8219) Eli Zaretskii
2011-03-11 20:58 ` bug#8219: " Chong Yidong
2011-03-12 8:15 ` Eli Zaretskii
2011-03-11 23:19 ` Stefan Monnier
2011-03-12 9:01 ` Eli Zaretskii
2011-03-12 20:47 ` Stefan Monnier
2011-03-13 16:30 ` bug#8219: " Chong Yidong
2011-03-13 17:09 ` Chong Yidong
2011-03-13 22:29 ` Chong Yidong
2011-03-14 2:41 ` bug#8219: " Juanma Barranquero
2011-03-14 16:18 ` Chong Yidong
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=877hc5bfqy.fsf@stupidchicken.com \
--to=cyd@stupidchicken.com \
--cc=8219@debbugs.gnu.org \
--cc=emacs-devel@gnu.org \
/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).