# HG changeset patch # User Richard M. Stallman # Date 853637679 0 # Node ID 245ba9f2781a7578821f9419e38d73f23b3e0079 # Parent 40ea37a6dc40b114fcb319fff8dfe61876a41249 (change_frame_size_1): Reject new sizes if they cause overflow. diff -r 40ea37a6dc40 -r 245ba9f2781a src/dispnew.c --- 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);