From 5cc152c0804748eb4c872ff34fe5414669e10745 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 11 May 2011 23:48:32 -0700 Subject: [PATCH] * menu.c (grow_menu_items): Check for int overflow. --- src/ChangeLog | 2 ++ src/menu.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 10b3ef2d6f2..913dcc05a10 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-05-12 Paul Eggert + * menu.c (grow_menu_items): Check for int overflow. + * xmenu.c (set_frame_menubar): Don't mishandle vectors with no nils. 2011-05-11 Paul Eggert diff --git a/src/menu.c b/src/menu.c index 7a3edcb6f4f..705100381d5 100644 --- a/src/menu.c +++ b/src/menu.c @@ -176,6 +176,8 @@ save_menu_items (void) static void grow_menu_items (void) { + if ((INT_MAX - MENU_ITEMS_PANE_LENGTH) / 2 < menu_items_allocated) + memory_full (); menu_items_allocated *= 2; menu_items = larger_vector (menu_items, menu_items_allocated, Qnil); } -- 2.39.2