bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#7244: `characterp' signals overflow-error


From: Lawrence Mitchell
Subject: bug#7244: `characterp' signals overflow-error
Date: Wed, 20 Oct 2010 17:56:59 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (usg-unix-v)

MON KEY wrote:
> On Mon, Oct 18, 2010 at 10:47 PM, Kenichi Handa <handa@m17n.org> wrote:
>> In article <AANLkTinNtQyW9XQrC56RE0ZqKEsC2B=SQDZT=QX2mLoD@mail.gmail.com>, 
>> MON KEY <monkey@sandpframing.com> writes:

>>> (characterp 2536870911) signals overflow-error "2536870911")
>>> ;=> Debugger entered--Lisp error: (overflow-error "2536870911")

>>> Why should this happen esp. when `max-char' sits just below the definition 
>>> in
>>> src/character.c ??

>> The error is signaled by Lisp reader; i.e. before characterp
>> is executed.

> OK. I didn't realize this.
> This said,  I am not understanding _where_ the overflow boundary is,
> e.g. following doesn't signal:

> most-positive-fixnum
> ;=> 536870911 (#o3777777777, #x1fffffff)

> (characterp 536870913)
> ;=> nil

Fread does this:

EMACS_INT n = (errno = 0, strtol (read_buffer, &endptr, 10));

So if the number to be read does not fit in a long int, then
you'll get a range error in strtol which is where the overflow
comes from.

For you, most-positive-fixnum == 2^29 - 1, so LONG_MAX == 2^31 -
1 (2147483647).  2536870911 > 2147483647.  So you get a
range error when trying to convert the number with strtol.

Lawrence

-- 
Lawrence Mitchell <wence@gmx.li>






reply via email to

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