unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: MOST_POSITIVE_FIXNUM and maximum buffer/string size
Date: Fri, 29 Apr 2011 13:28:38 -0300	[thread overview]
Message-ID: <jwvhb9hhvqa.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83bozp70ju.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 29 Apr 2011 14:35:17 +0300")

> Unless I'm missing something, this means we need to limit buffer sizes
> to MOST_POSITIVE_FIXNUM-1.

That's right (I wish I could change BEGV to 0, but that would break
a bit too much Elisp code, sadly, tho most of Emacs' own Elisp code is
somewhat clean in this respect).

> A related issue is with strings.  String positions are zero-based, so
> there's no problem with overflow there.  But if a string whose length
> is MOST_POSITIVE_FIXNUM is inserted into a buffer, we will again have
> an overflow.  So should we limit strings to MOST_POSITIVE_FIXNUM-1 as
> well?

I don't think so: when inserting a string, we have to check that we
don't make the buffer too large anyway, so there's no need to do
anything special in this respect.  Of course, we can also limit strings
to MOST_POSITIVE_FIXNUM-1, and I don't think anybody will mind, but it's
not necessary AFAIK.


        Stefan



      reply	other threads:[~2011-04-29 16:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-29 11:35 MOST_POSITIVE_FIXNUM and maximum buffer/string size Eli Zaretskii
2011-04-29 16:28 ` Stefan Monnier [this message]

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=jwvhb9hhvqa.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=eliz@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).