[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MOST_POSITIVE_FIXNUM and maximum buffer/string size

From: Stefan Monnier
Subject: Re: MOST_POSITIVE_FIXNUM and maximum buffer/string size
Date: Fri, 29 Apr 2011 13:28:38 -0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

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

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]