From d86c299a5f59a540fcf20a3604f626dc4235f29c Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 20 Jan 1997 01:21:07 +0000 Subject: [PATCH] (init_display): Check for overflow in screen size. --- src/dispnew.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/dispnew.c b/src/dispnew.c index 90d9fc2fc55..0301c57cb19 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -2549,6 +2549,22 @@ For types not defined in VMS, use define emacs_term \"TYPE\".\n\ term_init (terminal_type); + { + int width = FRAME_WINDOW_WIDTH (selected_frame); + int height = FRAME_HEIGHT (selected_frame); + + unsigned int total_glyphs = height * (width + 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) / height != width + 2) + { + fprintf (stderr, "emacs: screen size %dx%d too big\n,", + width, height); + exit (1); + } + } + remake_frame_glyphs (selected_frame); calculate_costs (selected_frame); -- 2.39.2