From: Paul Eggert Date: Thu, 12 May 2011 06:48:32 +0000 (-0700) Subject: * menu.c (grow_menu_items): Check for int overflow. X-Git-Tag: emacs-pretest-24.0.90~104^2~618^2~239^2~23^2~14 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5cc152c0804748eb4c872ff34fe5414669e10745;p=emacs.git * menu.c (grow_menu_items): Check for int overflow. --- 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); }