summaryrefslogtreecommitdiff
path: root/src/dispnew.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-01-19 01:34:39 +0000
committerRichard M. Stallman <rms@gnu.org>1997-01-19 01:34:39 +0000
commit3826ea1a0f0031676c7075f4ddd67da95d196b07 (patch)
treeec8c5667c98081807ea644a4c003ea4513c43fe9 /src/dispnew.c
parent5caa45d38ac6886add587da5ad8695a1f1de3651 (diff)
downloademacs-3826ea1a0f0031676c7075f4ddd67da95d196b07.tar.gz
(change_frame_size_1): Reject new sizes if they cause overflow.
Diffstat (limited to 'src/dispnew.c')
-rw-r--r--src/dispnew.c10
1 files changed, 10 insertions, 0 deletions
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);