diff options
| author | Richard M. Stallman | 1995-05-05 03:02:02 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-05-05 03:02:02 +0000 |
| commit | 14f6194bdcdbce5a37fc42545bb275e0d8d28c43 (patch) | |
| tree | ce59af0bc6c525285cfbd278da4a369233a2e556 /src | |
| parent | 8f4f023fe0082616ba70e0a3b88b964c4c9ef7ae (diff) | |
| download | emacs-14f6194bdcdbce5a37fc42545bb275e0d8d28c43.tar.gz emacs-14f6194bdcdbce5a37fc42545bb275e0d8d28c43.zip | |
(make_gap): Make this new error check also check exceeding VALBITS.
(insert_1): Delete old error test.
(min): New macro.
Diffstat (limited to 'src')
| -rw-r--r-- | src/insdel.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/insdel.c b/src/insdel.c index 59c789a4e82..0f5668f8712 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -25,6 +25,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 25 | #include "window.h" | 25 | #include "window.h" |
| 26 | #include "blockinput.h" | 26 | #include "blockinput.h" |
| 27 | 27 | ||
| 28 | #define min(x, y) ((x) < (y) ? (x) : (y)) | ||
| 29 | |||
| 28 | static void insert_from_string_1 (); | 30 | static void insert_from_string_1 (); |
| 29 | static void insert_from_buffer_1 (); | 31 | static void insert_from_buffer_1 (); |
| 30 | static void gap_left (); | 32 | static void gap_left (); |
| @@ -275,9 +277,9 @@ make_gap (increment) | |||
| 275 | even if it will fit in a Lisp integer. | 277 | even if it will fit in a Lisp integer. |
| 276 | That won't work because so many places use `int'. */ | 278 | That won't work because so many places use `int'. */ |
| 277 | 279 | ||
| 278 | if (VALBITS > INTBITS | 280 | if (Z - BEG + GAP_SIZE + increment |
| 279 | && (Z - BEG + GAP_SIZE + increment) >= ((unsigned) 1 << (INTBITS - 1))) | 281 | >= ((unsigned) 1 << (min (INTBITS, VALBITS) - 1))) |
| 280 | error ("Buffer too big"); | 282 | error ("Buffer exceeds maximum size"); |
| 281 | 283 | ||
| 282 | BLOCK_INPUT; | 284 | BLOCK_INPUT; |
| 283 | result = BUFFER_REALLOC (BEG_ADDR, (Z - BEG + GAP_SIZE + increment)); | 285 | result = BUFFER_REALLOC (BEG_ADDR, (Z - BEG + GAP_SIZE + increment)); |
| @@ -350,11 +352,6 @@ insert_1 (string, length, inherit, prepare) | |||
| 350 | { | 352 | { |
| 351 | register Lisp_Object temp; | 353 | register Lisp_Object temp; |
| 352 | 354 | ||
| 353 | /* Make sure point-max won't overflow after this insertion. */ | ||
| 354 | XSETINT (temp, length + Z); | ||
| 355 | if (length + Z != XINT (temp)) | ||
| 356 | error ("maximum buffer size exceeded"); | ||
| 357 | |||
| 358 | if (prepare) | 355 | if (prepare) |
| 359 | prepare_to_modify_buffer (PT, PT); | 356 | prepare_to_modify_buffer (PT, PT); |
| 360 | 357 | ||