diff options
| author | Richard M. Stallman | 1995-05-04 22:16:18 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-05-04 22:16:18 +0000 |
| commit | 94056516e269c6743ed0d3cdfe0242d61f788a44 (patch) | |
| tree | b69afef9947a94ea18b6da6b1fd9ebc4ef71cca5 /src | |
| parent | 34b4ece5fe5aa8bbc633b586a4a71e4712c4f949 (diff) | |
| download | emacs-94056516e269c6743ed0d3cdfe0242d61f788a44.tar.gz emacs-94056516e269c6743ed0d3cdfe0242d61f788a44.zip | |
(make_gap): Don't allow buffer size that won't fit in int.
Diffstat (limited to 'src')
| -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) | |||
| 271 | /* If we have to get more space, get enough to last a while. */ | 271 | /* If we have to get more space, get enough to last a while. */ |
| 272 | increment += 2000; | 272 | increment += 2000; |
| 273 | 273 | ||
| 274 | /* Don't allow a buffer size that won't fit in an int | ||
| 275 | even if it will fit in a Lisp integer. | ||
| 276 | That won't work because so many places use `int'. */ | ||
| 277 | |||
| 278 | if (VALBITS > INTBITS | ||
| 279 | && (Z - BEG + GAP_SIZE + increment) >= ((unsigned) 1 << (INTBITS - 1))) | ||
| 280 | error ("Buffer too big"); | ||
| 281 | |||
| 274 | BLOCK_INPUT; | 282 | BLOCK_INPUT; |
| 275 | result = BUFFER_REALLOC (BEG_ADDR, (Z - BEG + GAP_SIZE + increment)); | 283 | result = BUFFER_REALLOC (BEG_ADDR, (Z - BEG + GAP_SIZE + increment)); |
| 276 | 284 | ||