From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#55068: 29.0.50; crashes when trying to set default font Date: Mon, 23 May 2022 20:29:23 +0800 Message-ID: <87leusmnz0.fsf@yahoo.com> References: <87pmk4oadj.fsf@no.workgroup> <875ylwpmrn.fsf@gnus.org> <835ylw7amy.fsf@gnu.org> <87ilpwmpej.fsf@gnus.org> <87h75go3c2.fsf@yahoo.com> <87v8twl9nf.fsf@gnus.org> Reply-To: Po Lu Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28640"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) Cc: Eli Zaretskii , 55068@debbugs.gnu.org, telegraph@gmx.net To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 23 14:33:29 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nt7FY-0007CR-NL for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 23 May 2022 14:33:28 +0200 Original-Received: from localhost ([::1]:35516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nt7FX-0001GV-BV for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 23 May 2022 08:33:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nt7CF-0006h7-7F for bug-gnu-emacs@gnu.org; Mon, 23 May 2022 08:30:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53680) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nt7CE-0004TI-N6 for bug-gnu-emacs@gnu.org; Mon, 23 May 2022 08:30:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nt7CE-0005jL-Gy for bug-gnu-emacs@gnu.org; Mon, 23 May 2022 08:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 23 May 2022 12:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55068 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo confirmed Original-Received: via spool by 55068-submit@debbugs.gnu.org id=B55068.165330898021978 (code B ref 55068); Mon, 23 May 2022 12:30:02 +0000 Original-Received: (at 55068) by debbugs.gnu.org; 23 May 2022 12:29:40 +0000 Original-Received: from localhost ([127.0.0.1]:47577 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nt7Br-0005iQ-LO for submit@debbugs.gnu.org; Mon, 23 May 2022 08:29:39 -0400 Original-Received: from sonic301-31.consmr.mail.ne1.yahoo.com ([66.163.184.200]:45398) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nt7Bp-0005iA-7q for 55068@debbugs.gnu.org; Mon, 23 May 2022 08:29:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1653308971; bh=1SRzVER2vu+rTSnRUDxEkQCC/3Q/xrjPTDQS/AyUdfQ=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=UJSfGt3stOBlpH4MAdnqad5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Xelo0ThpDXchqvAs3WNi2pSXEoH9q70q0tYiCS_YI22 Gt5l.r5o8ygaRXdy1jWlg._amaaZsYai3q_397P9h_O49DDbx7ZMc9gTmCFKlTmKF25Qy24J_jY_ eNHXUrN2sAvGysFp_l1iGW6xglpqAEsf.r8gvtz5XZ6hRzTHQaRw60.2BBqEy.yaDCtePdEaEJwE 1KbWqsjrFukX3Vb7bnvSVK.NAGf1EFGcdDe.MGQkDVxG2t0Vlvd7AfFlLyXlAEBxFS7qEMIyiuxn qaCFwV9Gvga4JCTBepdDDV38Us9fpdodsrBLklzF5Ea9d0mnJfXz_tJbRQUdUsS2YtTS7ryjbkVy ywSEskxi_usl.X2LTuFVsJD7UCKSCSDsVLV_Si39ks4wX4oOWmbe_bBfgueqJtqjYAjhMx2ZYYGz unQyxW.D2bLsCmFHGxV1hVFA9WmNlEu3X1kX3D2aVV75HLEfAYvK_ciFo01JajwRCu6ZTCmzHp_T oo7uiig2MldFd7EXvdUeQMDmnaQr6IyrbBVZjzq7ErHHV6nq6deJU_tzTAHioJTfH1m8jMUxzERf rr5a2rwPfWIw1kTvVFQL5979ql6DSeJzvaQzn8EP0c X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.ne1.yahoo.com with HTTP; Mon, 23 May 2022 12:29:31 +0000 Original-Received: by hermes--canary-production-sg3-7959d4d9bd-56w7m (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 2985eb7ac68e475878c1674bca3d096f; Mon, 23 May 2022 12:29:28 +0000 (UTC) In-Reply-To: <87v8twl9nf.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 23 May 2022 14:24:04 +0200") X-Mailer: WebService/1.1.20225 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:232966 Archived-At: Lars Ingebrigtsen writes: > ==3291841== Warning: client switching stacks? SP change: 0x1ffeffdf60 --> 0x1ffe619240 > ==3291841== to suppress, use: --max-stackframe=10374432 or greater > ==3291841== Warning: client switching stacks? SP change: 0x1ffe619240 --> 0x1ffdc34520 > ==3291841== to suppress, use: --max-stackframe=10374432 or greater > ==3291841== Invalid write of size 8 > ==3291841== at 0x1E43BF: x_menu_show (xmenu.c:1903) > ==3291841== Address 0x1ffdc34518 is on thread 1's stack The stack overflowed because of the two allocas. Does it still crash with this patch? diff --git a/src/xmenu.c b/src/xmenu.c index aaf53569a7..e9601981ed 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -1894,13 +1894,19 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, { int i; widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; - widget_value **submenu_stack - = alloca (menu_items_used * sizeof *submenu_stack); - Lisp_Object *subprefix_stack - = alloca (menu_items_used * sizeof *subprefix_stack); + widget_value **submenu_stack; + Lisp_Object *subprefix_stack; int submenu_depth = 0; + specpdl_ref specpdl_count; - specpdl_ref specpdl_count = SPECPDL_INDEX (); + USE_SAFE_ALLOCA; + + submenu_stack = SAFE_ALLOCA (menu_items_used + * sizeof *submenu_stack); + subprefix_stack = SAFE_ALLOCA (menu_items_used + * sizeof *subprefix_stack); + + specpdl_count = SPECPDL_INDEX (); eassert (FRAME_X_P (f)); @@ -1909,6 +1915,7 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, if (menu_items_used <= MENU_ITEMS_PANE_LENGTH) { *error_name = "Empty menu"; + SAFE_FREE (); return Qnil; } @@ -2141,6 +2148,8 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, entry = Fcons (subprefix_stack[j], entry); } unblock_input (); + + SAFE_FREE (); return entry; } i += MENU_ITEMS_ITEM_LENGTH; @@ -2155,6 +2164,8 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, } unblock_input (); + + SAFE_FREE (); return Qnil; }