changeset 16881:245ba9f2781a

(change_frame_size_1): Reject new sizes if they cause overflow.
author Richard M. Stallman <rms@gnu.org>
date Sun, 19 Jan 1997 01:34:39 +0000
parents 40ea37a6dc40
children edebdaa8e499
files src/dispnew.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/dispnew.c	Sun Jan 19 01:28:07 1997 +0000
+++ b/src/dispnew.c	Sun Jan 19 01:34:39 1997 +0000
@@ -2067,6 +2067,7 @@
      int newheight, newwidth, pretend;
 {
   Lisp_Object tail, frame;
+
   if (! FRAME_WINDOW_P (f))
     {
       /* When using termcap, or on MS-DOS, all frames use
@@ -2086,6 +2087,8 @@
      int newheight, newwidth, pretend, delay;
 {
   int new_frame_window_width;
+  unsigned int total_glyphs;
+
   /* If we can't deal with the change now, queue it for later.  */
   if (delay)
     {
@@ -2106,6 +2109,13 @@
     newwidth  = FRAME_WIDTH  (frame);
   new_frame_window_width = FRAME_WINDOW_WIDTH_ARG (frame, newwidth);
 
+  total_glyphs = newheight * (newwidth + 2) * sizeof (GLYPH);
+
+  /* If these sizes are so big they cause overflow,
+     just ignore the change.  It's not clear what better we could do.  */
+  if (total_glyphs / sizeof (GLYPH) / newheight != newwidth + 2)
+    return;
+
   /* Round up to the smallest acceptable size.  */
   check_frame_size (frame, &newheight, &newwidth);