(change_frame_size_1): Reject new sizes if they cause overflow.

This commit is contained in:
Richard M. Stallman 1997-01-19 01:34:39 +00:00
parent 5caa45d38a
commit 3826ea1a0f

View file

@ -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);