From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#61704: 29.0.60; Crash in get_narrowed_begv Date: Wed, 22 Feb 2023 14:59:51 +0200 Message-ID: <83cz61svnc.fsf@gnu.org> References: <874jrdq4ct.fsf.ref@po-lus-librem-15.mail-host-address-is-not-set> <874jrdq4ct.fsf@po-lus-librem-15.mail-host-address-is-not-set> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2725"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, 61704@debbugs.gnu.org To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 22 14:00:33 2023 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 1pUojZ-0000Xj-KA for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 Feb 2023 14:00:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pUoj6-0004gl-MO; Wed, 22 Feb 2023 08:00:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUoj4-0004fr-IC for bug-gnu-emacs@gnu.org; Wed, 22 Feb 2023 08:00:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pUoj4-0007Dv-6V for bug-gnu-emacs@gnu.org; Wed, 22 Feb 2023 08:00:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pUoj4-0001gz-2Z for bug-gnu-emacs@gnu.org; Wed, 22 Feb 2023 08:00:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Feb 2023 13:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61704 X-GNU-PR-Package: emacs Original-Received: via spool by 61704-submit@debbugs.gnu.org id=B61704.16770707846445 (code B ref 61704); Wed, 22 Feb 2023 13:00:02 +0000 Original-Received: (at 61704) by debbugs.gnu.org; 22 Feb 2023 12:59:44 +0000 Original-Received: from localhost ([127.0.0.1]:58248 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pUoim-0001ft-7l for submit@debbugs.gnu.org; Wed, 22 Feb 2023 07:59:44 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45600) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pUoil-0001ff-1r for 61704@debbugs.gnu.org; Wed, 22 Feb 2023 07:59:43 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUoif-0007Bd-Qh; Wed, 22 Feb 2023 07:59:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=6z8v/tQOSYPlOhVds/oFCFArkrBztkiipM4ddJchwXE=; b=Qad6PDUsQwp7 m2dHSmiPHvUK/k1USh/JktBxLyiZtC7jGxayaYJRrcIxuuM3bBW9ayU+Dz555puWsZi/5KO8mfrDI 49irXyUFYEzFVCBsgz+OHRs6Jtuj16fYxgqVO7DdVJoTN1iHsrJIftEwDCPosmppZqVkcOc0A66MD pCx0MegKLilDQgO5cf+R5au3a+ctq24uojy6+6I0AJmFialUG9wRPrJWwvWcWQzJbDTyFbfztgQO6 yCA1IZTPEgQeCgNWKQdZqayvWYh7uMxE6youeOc/J+ocjqdlb2neVP9cPajMAt418i4ZLrAsgbbWr tXqFl1z+jwYI7UZM1voodg==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUoif-0002Sx-6u; Wed, 22 Feb 2023 07:59:37 -0500 In-Reply-To: (message from Gregory Heytings on Wed, 22 Feb 2023 12:48:02 +0000) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:256339 Archived-At: > Cc: 61704@debbugs.gnu.org > Date: Wed, 22 Feb 2023 12:48:02 +0000 > From: Gregory Heytings > > > > The cause is an arithmetic trap in get_narrowed_begv: > > > > return max ((pos / len - 1) * len, BEGV); > > > > where len is 0. The window was previously being resized, and has a > > pixel width of 24. > > > > How can len possibly be 0 at that point? It is (in short) > window_body_width (w, WINDOW_BODY_IN_CANONICAL_CHARS) * window_body_height > (w, WINDOW_BODY_IN_CANONICAL_CHARS). We could add a condition in > get_narrowed_len to return 1 when the result is 0, but it could be a bug > somewhere else (can a window body have a zero width and/or height?), in > which case it would be better to fix the bug there. I agree that we should understand how this happened (and asked a similar question), but I installed a defensive protection anyway. It cannot do any harm.