From unknown Mon Aug 18 02:36:50 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8215: possibly uninitialized variable lower_xoff in produce_glyphless_glyph Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 09 Mar 2011 22:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 8215 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 8215@debbugs.gnu.org Cc: Kenichi Handa X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.12997080263473 (code B ref -1); Wed, 09 Mar 2011 22:01:01 +0000 Received: (at submit) by debbugs.gnu.org; 9 Mar 2011 22:00:26 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PxRQg-0000tx-4L for submit@debbugs.gnu.org; Wed, 09 Mar 2011 17:00:26 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PxRQe-0000tl-1A for submit@debbugs.gnu.org; Wed, 09 Mar 2011 17:00:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PxRQY-0000db-1e for submit@debbugs.gnu.org; Wed, 09 Mar 2011 17:00:18 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:37091) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PxRQX-0000dX-Vf for submit@debbugs.gnu.org; Wed, 09 Mar 2011 17:00:17 -0500 Received: from [140.186.70.92] (port=46758 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PxRQW-0004lK-NG for bug-gnu-emacs@gnu.org; Wed, 09 Mar 2011 17:00:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PxRQV-0000cz-Ot for bug-gnu-emacs@gnu.org; Wed, 09 Mar 2011 17:00:16 -0500 Received: from smtp.cs.ucla.edu ([131.179.128.62]:58136) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PxRQV-0000cl-97 for bug-gnu-emacs@gnu.org; Wed, 09 Mar 2011 17:00:15 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id E4FB939E80DB; Wed, 9 Mar 2011 14:00:13 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 96wJD0QTXzPK; Wed, 9 Mar 2011 14:00:13 -0800 (PST) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 29EDF39E80F8; Wed, 9 Mar 2011 14:00:13 -0800 (PST) Message-ID: <4D77F86C.9080809@cs.ucla.edu> Date: Wed, 09 Mar 2011 14:00:12 -0800 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Thunderbird/3.1.7 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 199.232.76.165 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.0 (-----) I found this problem by compiling Emacs with GCC's -Wuninitialized flag. The following code in the Emacs trunk src/xdisp.c's produce_glyphless_glyph function might be using an uninitialized variable: if (base_width >= width) { /* Align the upper to the left, the lower to the right. */ it->pixel_width = base_width; lower_xoff = base_width - 2 - metrics_lower.width; } else { /* Center the shorter one. */ it->pixel_width = width; if (metrics_upper.width >= metrics_lower.width) lower_xoff = (width - metrics_lower.width) / 2; else upper_xoff = (width - metrics_upper.width) / 2; } ... if (it->glyph_row) append_glyphless_glyph (it, face_id, for_no_font, len, upper_xoff, upper_yoff, lower_xoff, lower_yoff); The last call uses lower_xoff, but the last "else" does not initialize lower_xoff. The bug cannot occur if it->glyph_row is NULL, but I don't see why that would necessarily be. So I'm filing a bug report so that someone who is more expert in this code can take a look at it. In the meantime, I plan to work around the problem by initializing lower_xoff to 0, with a FIXME explaining the situation: this shouldn't introduce a bug, because at worst it will replace undefined behavior with defined behavior. I'm CC'ing this to Kenichi Handa, who committed the code in question. From unknown Mon Aug 18 02:36:50 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8215: committed the workaround References: <4D77F86C.9080809@cs.ucla.edu> In-Reply-To: <4D77F86C.9080809@cs.ucla.edu> Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 23 Mar 2011 23:20:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8215 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 8229@debbugs.gnu.org, 8215@debbugs.gnu.org, 8211@debbugs.gnu.org Received: via spool by 8215-submit@debbugs.gnu.org id=B8215.13009223754358 (code B ref 8215); Wed, 23 Mar 2011 23:20:04 +0000 Received: (at 8215) by debbugs.gnu.org; 23 Mar 2011 23:19:35 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q2XKw-00018C-N5 for submit@debbugs.gnu.org; Wed, 23 Mar 2011 19:19:34 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q2XKt-00017n-J7; Wed, 23 Mar 2011 19:19:32 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 6E24D39E80E0; Wed, 23 Mar 2011 16:19:25 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rtc05Tc4HYDm; Wed, 23 Mar 2011 16:19:25 -0700 (PDT) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 1D12839E80B1; Wed, 23 Mar 2011 16:19:25 -0700 (PDT) Message-ID: <4D8A7FFC.60405@cs.ucla.edu> Date: Wed, 23 Mar 2011 16:19:24 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -3.2 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.2 (---) I committed my abovementioned workaround into the Emacs trunk on 2011-03-11 (bzr 103589). I don't consider this a fix, though, so I'm leaving this bug report open. From unknown Mon Aug 18 02:36:50 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8215: bug#8229: possibly uninitialized variable in load_charset Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 02 Jun 2021 08:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8215 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: 8211@debbugs.gnu.org, 8229@debbugs.gnu.org, 8215@debbugs.gnu.org Received: via spool by 8215-submit@debbugs.gnu.org id=B8215.162262102017481 (code B ref 8215); Wed, 02 Jun 2021 08:04:01 +0000 Received: (at 8215) by debbugs.gnu.org; 2 Jun 2021 08:03:40 +0000 Received: from localhost ([127.0.0.1]:38723 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1loLqh-0004Xi-Mw for submit@debbugs.gnu.org; Wed, 02 Jun 2021 04:03:40 -0400 Received: from quimby.gnus.org ([95.216.78.240]:55266) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1loLqY-0004XF-6d; Wed, 02 Jun 2021 04:03:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Slq47nx2PG3ZnEGfhMdK2/Kq5kusfvZq0WUeHx6yGpk=; b=W4P+umwFKL/IO84Ny++k6n78U9 xo5FNMCASdHi6WSuQsS7yw3wawU0u3c7nKYrYOs+tVNlzneSijaP5bmb7M9N7qkElUkV4yh2rCEWZ Oaz1GOcHd8Egs8d/HDPgeLBvRM4fLXNWjoeV6gaTva5lzqVMupycc3H0ztKKqLLFk6pM=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1loLqN-0003bg-FT; Wed, 02 Jun 2021 10:03:19 +0200 From: Lars Ingebrigtsen References: <4D796BAD.3060400@cs.ucla.edu> <4D8A7FFC.60405@cs.ucla.edu> X-Now-Playing: Nobukazu Takemura's _Child's View_: "Pastral Waltz" Date: Wed, 02 Jun 2021 10:03:14 +0200 In-Reply-To: <4D8A7FFC.60405@cs.ucla.edu> (Paul Eggert's message of "Wed, 23 Mar 2011 16:19:24 -0700") Message-ID: <87o8coelrx.fsf_-_@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Paul Eggert writes: > I committed my abovementioned workaround into the > Emacs trunk on 2011-03-11 (bzr 103589). I don't > consider this a fix, though, so I'm leaving this > bug report open. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Paul Eggert writes: > I committed my abovementioned workaround into the > Emacs trunk on 2011-03-11 (bzr 103589). I don't > consider this a fix, though, so I'm leaving this > bug report open. This was ten years ago: commit 0ac2c2991c1cba4e3c6e5f7b62c7d61b01d69994 Author: Paul Eggert AuthorDate: Mon Mar 7 16:46:23 2011 -0800 Commit: Paul Eggert CommitDate: Mon Mar 7 16:46:23 2011 -0800 * charset.c (load_charset): Abort instead of using uninitialized var. The code is still pretty much identical, as far as I can tell. Should this report be closed now? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From unknown Mon Aug 18 02:36:50 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8215: possibly uninitialized variable lower_xoff in produce_glyphless_glyph Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 02 Jun 2021 08:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8215 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: 8215@debbugs.gnu.org, Kenichi Handa Received: via spool by 8215-submit@debbugs.gnu.org id=B8215.162262120917797 (code B ref 8215); Wed, 02 Jun 2021 08:07:02 +0000 Received: (at 8215) by debbugs.gnu.org; 2 Jun 2021 08:06:49 +0000 Received: from localhost ([127.0.0.1]:38732 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1loLti-0004cr-PY for submit@debbugs.gnu.org; Wed, 02 Jun 2021 04:06:49 -0400 Received: from quimby.gnus.org ([95.216.78.240]:55376) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1loLtg-0004ce-LX for 8215@debbugs.gnu.org; Wed, 02 Jun 2021 04:06:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZhvZOlGcNp9JcgpYojdNfqG18tjeWQBa6Xmq27gqX4I=; b=O7NuGtFhdMdNn+84S2NI8a53Si wj5HlhAvqQLvuIhxba6ouxtCEtYpAqI5PlCutZwzLgqptBn9VvfkeXHnPtsaeMZZAkPggxFaFK8sI Vkz5UFdpMUYrkGbiL0E173lMXUQKdqne3uL774lvi27aDFJ9CxM8/Hn6ueF8Xw45Mwa8=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1loLtV-0003ck-Pn; Wed, 02 Jun 2021 10:06:33 +0200 From: Lars Ingebrigtsen References: <4D77F86C.9080809@cs.ucla.edu> X-Now-Playing: Nobukazu Takemura's _Child's View_: "Ill At Ease" Date: Wed, 02 Jun 2021 10:06:29 +0200 In-Reply-To: <4D77F86C.9080809@cs.ucla.edu> (Paul Eggert's message of "Wed, 09 Mar 2011 14:00:12 -0800") Message-ID: <87k0ncelmi.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Paul Eggert writes: > In the meantime, I plan to work around the problem by initializing > lower_xoff to 0, with a FIXME explaining the situation: this shouldn't > introduce a bug, because at worst it will replace undefi [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Paul Eggert writes: > In the meantime, I plan to work around the problem by initializing > lower_xoff to 0, with a FIXME explaining the situation: this shouldn't > introduce a bug, because at worst it will replace undefined behavior > with defined behavior. It looks like this code is still in place now, ten years later: diff --git a/src/xdisp.c b/src/xdisp.c index 44cb713011..44a317b578 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -22292,7 +22292,13 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) if (metrics_upper.width >= metrics_lower.width) lower_xoff = (width - metrics_lower.width) / 2; else - upper_xoff = (width - metrics_upper.width) / 2; + { + /* FIXME: This code doesn't look right. It formerly was + missing the "lower_xoff = 0;", which couldn't have + been right since it left lower_xoff uninitialized. */ + lower_xoff = 0; + upper_xoff = (width - metrics_upper.width) / 2; + } } /* +5 is for horizontal bars of a box plus 1-pixel spaces at Anybody have any insight into whether this is correct or not now? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From unknown Mon Aug 18 02:36:50 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8215: possibly uninitialized variable lower_xoff in produce_glyphless_glyph Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 02 Jun 2021 13:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8215 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Lars Ingebrigtsen Cc: Kenichi Handa , eggert@cs.ucla.edu, 8215@debbugs.gnu.org Received: via spool by 8215-submit@debbugs.gnu.org id=B8215.16226398612577 (code B ref 8215); Wed, 02 Jun 2021 13:18:01 +0000 Received: (at 8215) by debbugs.gnu.org; 2 Jun 2021 13:17:41 +0000 Received: from localhost ([127.0.0.1]:39234 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1loQkb-0000fR-4k for submit@debbugs.gnu.org; Wed, 02 Jun 2021 09:17:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41920) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1loQkW-0000fB-2u for 8215@debbugs.gnu.org; Wed, 02 Jun 2021 09:17:36 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:47600) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1loQkO-00061W-6L; Wed, 02 Jun 2021 09:17:26 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4300 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 1loQkM-0007D5-5W; Wed, 02 Jun 2021 09:17:23 -0400 Date: Wed, 02 Jun 2021 16:17:11 +0300 Message-Id: <83sg20xv6w.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87k0ncelmi.fsf@gnus.org> (message from Lars Ingebrigtsen on Wed, 02 Jun 2021 10:06:29 +0200) References: <4D77F86C.9080809@cs.ucla.edu> <87k0ncelmi.fsf@gnus.org> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Lars Ingebrigtsen > Date: Wed, 02 Jun 2021 10:06:29 +0200 > Cc: 8215@debbugs.gnu.org, Kenichi Handa > > Paul Eggert writes: > > > In the meantime, I plan to work around the problem by initializing > > lower_xoff to 0, with a FIXME explaining the situation: this shouldn't > > introduce a bug, because at worst it will replace undefined behavior > > with defined behavior. > > It looks like this code is still in place now, ten years later: > > diff --git a/src/xdisp.c b/src/xdisp.c > index 44cb713011..44a317b578 100644 > --- a/src/xdisp.c > +++ b/src/xdisp.c > @@ -22292,7 +22292,13 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) > if (metrics_upper.width >= metrics_lower.width) > lower_xoff = (width - metrics_lower.width) / 2; > else > - upper_xoff = (width - metrics_upper.width) / 2; > + { > + /* FIXME: This code doesn't look right. It formerly was > + missing the "lower_xoff = 0;", which couldn't have > + been right since it left lower_xoff uninitialized. */ > + lower_xoff = 0; > + upper_xoff = (width - metrics_upper.width) / 2; > + } > } > > /* +5 is for horizontal bars of a box plus 1-pixel spaces at > > Anybody have any insight into whether this is correct or not now? I fixed this (and removed the FIXME with the incorrect initialization). Bottom line: it was a typo. From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 02 09:18:05 2021 Received: (at control) by debbugs.gnu.org; 2 Jun 2021 13:18:05 +0000 Received: from localhost ([127.0.0.1]:39238 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1loQl3-0000gY-G0 for submit@debbugs.gnu.org; Wed, 02 Jun 2021 09:18:05 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42084) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1loQl0-0000fu-Ks for control@debbugs.gnu.org; Wed, 02 Jun 2021 09:18:03 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:47634) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1loQkv-0006CT-Eq for control@debbugs.gnu.org; Wed, 02 Jun 2021 09:17:57 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4340 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 1loQkv-0007EQ-1G for control@debbugs.gnu.org; Wed, 02 Jun 2021 09:17:57 -0400 Date: Wed, 02 Jun 2021 16:17:46 +0300 Message-Id: <83r1hkxv5x.fsf@gnu.org> From: Eli Zaretskii To: control@debbugs.gnu.org In-Reply-To: <87k0ncelmi.fsf@gnus.org> (message from Lars Ingebrigtsen on Wed, 02 Jun 2021 10:06:29 +0200) Subject: Re: bug#8215: possibly uninitialized variable lower_xoff in produce_glyphless_glyph References: <4D77F86C.9080809@cs.ucla.edu> <87k0ncelmi.fsf@gnus.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 8215 thanks From unknown Mon Aug 18 02:36:50 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8215: possibly uninitialized variable lower_xoff in produce_glyphless_glyph Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Jun 2021 09:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8215 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: Kenichi Handa , eggert@cs.ucla.edu, 8215@debbugs.gnu.org Received: via spool by 8215-submit@debbugs.gnu.org id=B8215.162297002512634 (code B ref 8215); Sun, 06 Jun 2021 09:01:02 +0000 Received: (at 8215) by debbugs.gnu.org; 6 Jun 2021 09:00:25 +0000 Received: from localhost ([127.0.0.1]:50609 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lpodp-0003DR-DS for submit@debbugs.gnu.org; Sun, 06 Jun 2021 05:00:25 -0400 Received: from quimby.gnus.org ([95.216.78.240]:57080) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lpodk-00033i-Ms for 8215@debbugs.gnu.org; Sun, 06 Jun 2021 05:00:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=B/bq4nUPe9sxV02dR+sEs+yDemBk6DmFHpa5jxcaTYA=; b=e98AKqY0PII8TvHkaX6LEL6+Qs MEqdPvPyFneHyRFD/7aYwK1KSfDbaGYsvfrP30ZW47bWKRMKGTNXRGgn8ELIKGDusMSEzvIG2magI MzhArVw4zgEnShUoWzQ0iEEEnPm4n+U7hIylmyCm47FfcjgRZlZZtuGXLr7vhvu3q6PQ=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lpodZ-0004f2-Cp; Sun, 06 Jun 2021 11:00:09 +0200 From: Lars Ingebrigtsen References: <4D77F86C.9080809@cs.ucla.edu> <87k0ncelmi.fsf@gnus.org> <83sg20xv6w.fsf@gnu.org> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAGFBMVEX489f+/Obe2sPY z66ckVlgYCIvLxn///8+Oln3AAAAAWJLR0QHFmGI6wAAAAd0SU1FB+UGBgg6EBZ7FUgAAAFoSURB VDjLnZRtkoMgDIax9gAyvYArPYBD2v3dGaEH2GIOsJXc/wgN+IWWzuxs/CHDY94XAlEUMhdVJfJA zkBppaAEUKDbLQAdZhWA1hsQhxzFXkrKg9JB6OsN5MzPZhe3CVz7Xfz8D8i/AJMBzuQynP0oNRPM euAHc2doiucGuFYcs+DBVS/vM5AjYG+81eLUAY92GXQTolIDGGMX8+8IdC3EBYew0d9NBtSNyCzX mq6F2mLcaZoBtQLXnvpj2GgCnG7U2XfQcobHdVXoAEpL/hKsfeKBXA+wSF2/A70drDNIw5WmVcll uehZhh73WJ0UjIUfLCttM0ZAHgl9moE+fMovpD6p7nSAPtbGj1LFYh4pZ+wAfxowMvBvUoEiET6X jOV+REArIBxrEbSI/ArCnGeTsI35liwgmET/cB5V7FPxFrGFQysKwTfhsEyPrV0V/OMotWq0bvhR rZCrSNUkUciN+q7LP8cL2tDmE4p07lIAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjEtMDYtMDZUMDg6 NTg6MTYrMDA6MDBCAGq6AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIxLTA2LTA2VDA4OjU4OjE2KzAw OjAwM13SBgAAAABJRU5ErkJggg== X-Now-Playing: Geotic's _Breathing Instruments_: "Uncaught" Date: Sun, 06 Jun 2021 11:00:04 +0200 In-Reply-To: <83sg20xv6w.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 02 Jun 2021 16:17:11 +0300") Message-ID: <87wnr7v04r.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Eli Zaretskii writes: > I fixed this (and removed the FIXME with the incorrect > initialization). Bottom line: it was a typo. Nice catch. :-) I tried reading that function for a couple of minutes to try to make sense how lower_xoff should have been initialised, but I had to admit defeat. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Eli Zaretskii writes: > I fixed this (and removed the FIXME with the incorrect > initialization). Bottom line: it was a typo. Nice catch. :-) I tried reading that function for a couple of minutes to try to make sense how lower_xoff should have been initialised, but I had to admit defeat. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From unknown Mon Aug 18 02:36:50 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8215: possibly uninitialized variable lower_xoff in produce_glyphless_glyph Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Jun 2021 09:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8215 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Lars Ingebrigtsen Cc: handa@gnu.org, eggert@cs.ucla.edu, 8215@debbugs.gnu.org Received: via spool by 8215-submit@debbugs.gnu.org id=B8215.162297083620780 (code B ref 8215); Sun, 06 Jun 2021 09:14:02 +0000 Received: (at 8215) by debbugs.gnu.org; 6 Jun 2021 09:13:56 +0000 Received: from localhost ([127.0.0.1]:50634 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lpoqy-0005P6-9c for submit@debbugs.gnu.org; Sun, 06 Jun 2021 05:13:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41890) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lpoqt-0005Oq-HU for 8215@debbugs.gnu.org; Sun, 06 Jun 2021 05:13:55 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46594) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpoqn-00008B-F7; Sun, 06 Jun 2021 05:13:45 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4372 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 1lpoqn-0000y2-2O; Sun, 06 Jun 2021 05:13:45 -0400 Date: Sun, 06 Jun 2021 12:13:41 +0300 Message-Id: <83lf7nice2.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87wnr7v04r.fsf@gnus.org> (message from Lars Ingebrigtsen on Sun, 06 Jun 2021 11:00:04 +0200) References: <4D77F86C.9080809@cs.ucla.edu> <87k0ncelmi.fsf@gnus.org> <83sg20xv6w.fsf@gnu.org> <87wnr7v04r.fsf@gnus.org> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Lars Ingebrigtsen > Cc: eggert@cs.ucla.edu, 8215@debbugs.gnu.org, Kenichi Handa > Date: Sun, 06 Jun 2021 11:00:04 +0200 > > Nice catch. :-) I tried reading that function for a couple of minutes > to try to make sense how lower_xoff should have been initialised, but I > had to admit defeat. The reason we didn't have the fix earlier is that the problem is only visible when the default face's font is variable-pitch, otherwise the offending code is never executed. So it was hard to understand what that "workaround" initialization caused. Let me know if I should add some comments there to make the code's intent and purpose more clear.