changeset 11691:ca7058c74ef3

(make_gap): Don't allow buffer size that won't fit in int.
author Richard M. Stallman <rms@gnu.org>
date Thu, 04 May 1995 22:16:18 +0000
parents 450b9598aca5
children b7c7710644d3
files src/insdel.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/insdel.c	Thu May 04 21:57:30 1995 +0000
+++ b/src/insdel.c	Thu May 04 22:16:18 1995 +0000
@@ -271,6 +271,14 @@
   /* 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));