From: Dmitry Antipov <antipov@dev.rtsoft.ru>
Subject: Re: Re: Crash calling md5 for a list of buffers
Date: Thu, 22 Jan 2004 14:34:45 +0300 [thread overview]
Message-ID: <400FB555.2000403@dev.rtsoft.ru> (raw)
Kevin Rodgers wrote:
> There must be something wrong in the code in fns.c:Fmd5() that computes
> and checks the buffer beginning and end when its run with object set to
> the xdisp.c buffer, because either the subsequent call to
> select-safe-coding-system (via Vselect_safe_coding_system_function) or
> make_buffer_string is passed an end argument that is 1 larger than the
> buffer size (which precipitates the Lisp error or the crash,
> respectively). Can anyone see what's wrong here?
IMHO this code is correct, but Fmd5 really has stupid error. Here it is.
If 1st arg is a string, all goes ok. If it's a buffer, we have a
'struct buffer *bp' which points to the buffer to process. For buffer
'bp' points to, we are calculating begin (b) and end (e) boundaries.
Then, after selecting coding system, we do 'make_buffer_string (b, e, 0)'.
But this function works with 'struct buffer *current_buffer', not with
'bp' ! So, if the size of buffer pointed via *bp is more than the size
of *current_buffer, we have an abort():
make_buffer_string() -> CHAR_TO_BYTE(end) -> buf_charpos_to_bytepos(...):
...
if (charpos < BUF_BEG (b) || charpos > BUF_Z (b))
abort ();
...
because 'b' here points to the current buffer, but 'charpos' arg is
calculated for *bp from Fmd5.
An obvious (but I'm not sure the best, btw) fix is:
...
struct buffer *bt;
...
bt = current_buffer, current_buffer = bp;
object = make_buffer_string (b, e, 0);
current_buffer = bt;
...
I've already posted it here (see my e-mail "Probably fixed..."), but
still has no reply on it :-(.
Tnanks for your help,
Dmitry
reply other threads:[~2004-01-22 11:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=400FB555.2000403@dev.rtsoft.ru \
--to=antipov@dev.rtsoft.ru \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.