diff options
author | Richard M. Stallman <rms@gnu.org> | 1995-05-04 22:16:18 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1995-05-04 22:16:18 +0000 |
commit | 86f92480599f2e16b2a16deb758e4d88113b6e6b (patch) | |
tree | 6bf9cd511ace8c8352fa4b92d73c8ca5e38878b0 /src/insdel.c | |
parent | 6592e8aa3dde8a768aa4f409cee268d4ba2084d5 (diff) | |
download | emacs-86f92480599f2e16b2a16deb758e4d88113b6e6b.tar.gz |
(make_gap): Don't allow buffer size that won't fit in int.
Diffstat (limited to 'src/insdel.c')
-rw-r--r-- | src/insdel.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/insdel.c b/src/insdel.c index bf4a7e74f01..59c789a4e82 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -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)); |