unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: Crash calling md5 for a list of buffers
Date: Wed, 21 Jan 2004 10:20:41 -0700	[thread overview]
Message-ID: <400EB4E9.5020408@yahoo.com> (raw)
In-Reply-To: mailman.1088.1074672016.928.bug-gnu-emacs@gnu.org

Dmitry Antipov wrote:

> Kevin Rodgers wrote:
> 
>>> I cannot reproduce that on GNU Emacs 21.3.1 (i386-pc-solaris2.7, X
>>> toolkit) of 2003-04-24 on briard.  If I go to the emacs-21.3/src
>>> directory, start Emacs as `./emacs-21.3.1 -q --no-site-file *.c',
>>> then type `M-: (mapcar 'md5 (buffer-list)) RET', I get the following
>>> *Backtrace*:
>>>
>>> Debugger entered--Lisp error: (args-out-of-range 1 459097)
>>>   find-coding-systems-region-internal(1 459097)
>>>  find-coding-systems-region(1 459097)
>>>  select-safe-coding-system(1 459097 undecided-unix)
>>>  md5(#<buffer xdisp.c>)
>>
>>
>> Apparently that's because the xdisp.c buffer only has 459096 characters.
>> Whether I visit it with find-file or find-file-literally, `M->' followed
>> by `C-x =' reports "point=459097 of 459096 (100%) column 0".
> 
> 
> Try to eval (mapcar '(lambda (b) (md5 b nil nil 'raw-text)) (buffer-list)).
> (mapcar 'md5 (buffer-list)) doesn't work for all buffers (really I don't 
> understand why - probably the coding system determined automagically is
> not always valid for Fmd5).


OK, then I get the same crash that you reported.  The interesting thing
is that both the crash and the Lisp error occur while processing
xdisp.c.  There is something screwy with that file that causes Emacs to
think it has 1 more character (459097) than it really does (459096).  If
I kill that buffer before mapping md5 over buffer-list, neither the
crash nor the Lisp error occur.

Running emacs with --unibyte didn't prevent the Lisp error or the crash
on xdisp.c.  I'm confused because that file doesn't contain any odd
characters, just printable ASCII chars, newline (^J), tab (^I), and
formfeed (^L).

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?

       CHECK_BUFFER (object, 0);

       bp = XBUFFER (object);
	
       if (NILP (start))
	b = BUF_BEGV (bp);
       else
	{
	  CHECK_NUMBER_COERCE_MARKER (start, 0);
	  b = XINT (start);
	}

       if (NILP (end))
	e = BUF_ZV (bp);
       else
	{
	  CHECK_NUMBER_COERCE_MARKER (end, 1);
	  e = XINT (end);
	}

       if (b > e)
	temp = b, b = e, e = temp;

       if (!(BUF_BEGV (bp) <= b && e <= BUF_ZV (bp)))
	args_out_of_range (start, end);


-- 
Kevin Rodgers

       reply	other threads:[~2004-01-21 17:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1088.1074672016.928.bug-gnu-emacs@gnu.org>
2004-01-21 17:20 ` Kevin Rodgers [this message]
2004-01-21  8:56 Crash calling md5 for a list of buffers Dmitry Antipov
     [not found] <mailman.991.1074595908.928.bug-gnu-emacs@gnu.org>
2004-01-20 17:11 ` Kevin Rodgers
     [not found] ` <mailman.1021.1074618759.928.bug-gnu-emacs@gnu.org>
2004-01-20 18:57   ` Kevin Rodgers
  -- strict thread matches above, loose matches on Subject: below --
2004-01-20 11:41 Dmitry Antipov

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=400EB4E9.5020408@yahoo.com \
    --to=ihs_4664@yahoo.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).