aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-01-19 01:34:39 +0000
committerRichard M. Stallman1997-01-19 01:34:39 +0000
commit3826ea1a0f0031676c7075f4ddd67da95d196b07 (patch)
treeec8c5667c98081807ea644a4c003ea4513c43fe9
parent5caa45d38ac6886add587da5ad8695a1f1de3651 (diff)
downloademacs-3826ea1a0f0031676c7075f4ddd67da95d196b07.tar.gz
emacs-3826ea1a0f0031676c7075f4ddd67da95d196b07.zip
(change_frame_size_1): Reject new sizes if they cause overflow.
-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)
2067 int newheight, newwidth, pretend; 2067 int newheight, newwidth, pretend;
2068{ 2068{
2069 Lisp_Object tail, frame; 2069 Lisp_Object tail, frame;
2070
2070 if (! FRAME_WINDOW_P (f)) 2071 if (! FRAME_WINDOW_P (f))
2071 { 2072 {
2072 /* When using termcap, or on MS-DOS, all frames use 2073 /* When using termcap, or on MS-DOS, all frames use
@@ -2086,6 +2087,8 @@ change_frame_size_1 (frame, newheight, newwidth, pretend, delay)
2086 int newheight, newwidth, pretend, delay; 2087 int newheight, newwidth, pretend, delay;
2087{ 2088{
2088 int new_frame_window_width; 2089 int new_frame_window_width;
2090 unsigned int total_glyphs;
2091
2089 /* If we can't deal with the change now, queue it for later. */ 2092 /* If we can't deal with the change now, queue it for later. */
2090 if (delay) 2093 if (delay)
2091 { 2094 {
@@ -2106,6 +2109,13 @@ change_frame_size_1 (frame, newheight, newwidth, pretend, delay)
2106 newwidth = FRAME_WIDTH (frame); 2109 newwidth = FRAME_WIDTH (frame);
2107 new_frame_window_width = FRAME_WINDOW_WIDTH_ARG (frame, newwidth); 2110 new_frame_window_width = FRAME_WINDOW_WIDTH_ARG (frame, newwidth);
2108 2111
2112 total_glyphs = newheight * (newwidth + 2) * sizeof (GLYPH);
2113
2114 /* If these sizes are so big they cause overflow,
2115 just ignore the change. It's not clear what better we could do. */
2116 if (total_glyphs / sizeof (GLYPH) / newheight != newwidth + 2)
2117 return;
2118
2109 /* Round up to the smallest acceptable size. */ 2119 /* Round up to the smallest acceptable size. */
2110 check_frame_size (frame, &newheight, &newwidth); 2120 check_frame_size (frame, &newheight, &newwidth);
2111 2121