From: Richard M. Stallman Date: Sun, 19 Jan 1997 01:34:39 +0000 (+0000) Subject: (change_frame_size_1): Reject new sizes if they cause overflow. X-Git-Tag: emacs-20.1~3063 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3826ea1a0f0031676c7075f4ddd67da95d196b07;p=emacs.git (change_frame_size_1): Reject new sizes if they cause overflow. --- diff --git a/src/dispnew.c b/src/dispnew.c index 388bae255ac..90d9fc2fc55 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -2067,6 +2067,7 @@ change_frame_size (f, newheight, newwidth, pretend, delay) 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 @@ change_frame_size_1 (frame, newheight, newwidth, pretend, delay) 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 @@ change_frame_size_1 (frame, newheight, newwidth, pretend, delay) 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);