Commit 94056516 authored by Richard M. Stallman's avatar Richard M. Stallman

(make_gap): Don't allow buffer size that won't fit in int.

parent 34b4ece5
......@@ -271,6 +271,14 @@ make_gap (increment)
/* If we have to get more space, get enough to last a while. */
increment += 2000;
/* Don't allow a buffer size that won't fit in an int
even if it will fit in a Lisp integer.
That won't work because so many places use `int'. */
if (VALBITS > INTBITS
&& (Z - BEG + GAP_SIZE + increment) >= ((unsigned) 1 << (INTBITS - 1)))
error ("Buffer too big");
BLOCK_INPUT;
result = BUFFER_REALLOC (BEG_ADDR, (Z - BEG + GAP_SIZE + increment));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment