[PATCH] gnu: emacs: Ignore empty XIM styles.

  • Done
  • quality assurance status badge
Details
2 participants
  • Leo Prikler
  • Mathieu Othacehe
Owner
unassigned
Submitted by
Leo Prikler
Severity
normal

Debbugs page

Leo Prikler wrote 5 years ago
(address . guix-patches@gnu.org)
20200802184655.30348-1-leo.prikler@student.tugraz.at
As of libx11 version 1.6.10, xim may be NULL, which causes a segmentation
fault in the execution of ARRAYELTS. As a cautionary measure, we
short-circuit this logic.

* gnu/packages/patches/emacs-ignore-empty-xim-styles.patch: New file.
* gnu/packages/emacs.scm (emacs emacs-next)[patches]: Use it.
* gnu/local.mk: Register it.
---
gnu/local.mk | 1 +
gnu/packages/emacs.scm | 2 ++
.../emacs-ignore-empty-xim-styles.patch | 21 +++++++++++++++++++
3 files changed, 24 insertions(+)
create mode 100644 gnu/packages/patches/emacs-ignore-empty-xim-styles.patch

Toggle diff (59 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 9d295267a8..0144965827 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -917,6 +917,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-exec-path.patch \
%D%/packages/patches/emacs-exwm-fix-fullscreen-states.patch \
%D%/packages/patches/emacs-fix-scheme-indent-function.patch \
+ %D%/packages/patches/emacs-ignore-empty-xim-styles.patch \
%D%/packages/patches/emacs-json-reformat-fix-tests.patch \
%D%/packages/patches/emacs-highlight-stages-add-gexp.patch \
%D%/packages/patches/emacs-hyperbole-toggle-messaging.patch \
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 8fe5750791..ad8d4b0606 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -85,6 +85,7 @@
"119ldpk7sgn9jlpyngv5y4z3i7bb8q3xp4p0qqi7i5nq39syd42d"))
(patches (search-patches "emacs-exec-path.patch"
"emacs-fix-scheme-indent-function.patch"
+ "emacs-ignore-empty-xim-styles.patch"
"emacs-source-date-epoch.patch"))
(modules '((guix build utils)))
(snippet
@@ -261,6 +262,7 @@ languages.")
(file-name (git-file-name name version))
(patches (search-patches "emacs27-exec-path.patch"
"emacs-fix-scheme-indent-function.patch"
+ "emacs-ignore-empty-xim-styles.patch"
"emacs-source-date-epoch.patch"))
(modules (origin-modules (package-source emacs)))
;; TODO: once the snippet for `emacs' is changed to not fail when
diff --git a/gnu/packages/patches/emacs-ignore-empty-xim-styles.patch b/gnu/packages/patches/emacs-ignore-empty-xim-styles.patch
new file mode 100644
index 0000000000..936b7a81f7
--- /dev/null
+++ b/gnu/packages/patches/emacs-ignore-empty-xim-styles.patch
@@ -0,0 +1,21 @@
+Index: emacs-26.3/src/xfns.c
+===================================================================
+--- emacs-26.3.orig/src/xfns.c
++++ emacs-26.3/src/xfns.c
+@@ -2533,6 +2533,8 @@ xic_free_xfontset (struct frame *f)
+ static XIMStyle
+ best_xim_style (XIMStyles *xim)
+ {
++ if (xim == NULL) goto out;
++
+ int i, j;
+ int nr_supported = ARRAYELTS (supported_xim_styles);
+
+@@ -2541,6 +2543,7 @@ best_xim_style (XIMStyles *xim)
+ if (supported_xim_styles[i] == xim->supported_styles[j])
+ return supported_xim_styles[i];
+
++ out:
+ /* Return the default style. */
+ return XIMPreeditNothing | XIMStatusNothing;
+ }
--
2.28.0
Mathieu Othacehe wrote 5 years ago
(name . Leo Prikler)(address . leo.prikler@student.tugraz.at)(address . 42680@debbugs.gnu.org)
87eeoourds.fsf@gnu.org
Hey Leo,

Toggle quote (4 lines)
> "emacs-fix-scheme-indent-function.patch"
> + "emacs-ignore-empty-xim-styles.patch"
> "emacs-source-date-epoch.patch"))

This patch looks fine, thanks! Did you report this issue upstream?

Mathieu
Leo Prikler wrote 5 years ago
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 42680@debbugs.gnu.org)
4fe7baa86b165a9080e3730d434a10dbfd202614.camel@student.tugraz.at
Am Montag, den 03.08.2020, 09:21 +0200 schrieb Mathieu Othacehe:
Toggle quote (12 lines)
> Hey Leo,
>
> > "emacs-fix-scheme-indent-
> > function.patch"
> > + "emacs-ignore-empty-xim-
> > styles.patch"
> > "emacs-source-date-
> > epoch.patch"))
>
> This patch looks fine, thanks! Did you report this issue upstream?
>
> Mathieu
I have now, it's #42694.
Mathieu Othacehe wrote 5 years ago
(name . Leo Prikler)(address . leo.prikler@student.tugraz.at)(address . 42680-done@debbugs.gnu.org)
87o8nst3lk.fsf@gnu.org
Toggle quote (5 lines)
>> This patch looks fine, thanks! Did you report this issue upstream?
>>
>> Mathieu
> I have now, it's #42694.

Great, patch pushed with a reference to the proposed fix.

Thanks,

Mathieu
Closed
Leo Prikler wrote 5 years ago
Fwd: Re: bug#42694: 26.3; Emacs crashes when linked against newer libx11
(address . 42680@debbugs.gnu.org)
d38723124f789cbbdee4c5834238b2dcb38a7bbb.camel@student.tugraz.at
It turns out, that this bug got fixed upstream independently using a
slightly different patch.
Return-Path: <eliz@gnu.org>
Received: from mail.sbox.tugraz.at ([unix socket])
by sbox.tugraz.at (Cyrus 2.5.12-TUGraz) with LMTPA;
Mon, 03 Aug 2020 16:41:00 +0200
X-Sieve: CMU Sieve 2.4
Received: from mxesa2.tugraz.at (mailgate.tugraz.at [129.27.2.197]) by
mail.sbox.tugraz.at (Postfix) with ESMTPS id 7857D1A0F82 for
<leoprikler@mail.sbox.tugraz.at>; Mon, 3 Aug 2020 16:41:00 +0200 (CEST)
Authentication-Results: mxesa2.tugraz.at; dkim=none (message not signed)
header.i=none
IronPort-SDR: WV16fBi2y7Ra4ITOLp1O/z7BuTiGa0h6c4Se9zNjrwwGEBnT8WbMY9zWBCkRKxPh4be3LaV2u7
VXUhNxVl18llYpvcsu/NgU0Qec1U025vFZ2c++NzzABojnTqY1xgqVm5dvi8QG1Lk+vMvZVL3I
sPFHOph/q6TVEpe5xs6AhMGz1/CLI14IhenXHisGWbXg0VYJ5jwQlNKqnn7y6IwYoaUcYTJZ7i
62riKkPqVBhxLbN9VI/x7flGGTIJVbPZ0iLN4RR8PtV+EbfJUWTohuDta+D2psAu1tGn6mJJ/t
GwkcrROdmN4JsFhdbw1nBN85
X-IPAS-Result: =?us-ascii?q?A0GOBQCLIShfe1y8M9FgH4QGUYFMMSyVToECmwwLAQECA?=
=?us-ascii?q?QEBAQEILAECBAEBhEwCgjsCJDgTAgMBAQEDAgMBAQEBAQQBAQECAQEFAgEBA?=
=?us-ascii?q?gIQAQGBBWBbgUeBcgYEPIZKAQEBAQIBeQULCxQBDCUPAUcGE4YDIAEDAbEtg?=
=?us-ascii?q?iiFU4NHgUCBOI0OGoFBP4ERglsHLj6KMwSbW5ozgmuBDY4ViwiRUY4psXKBa?=
=?us-ascii?q?iGBWk0wCIMkTQECAQIBDAECAgECAQICCAEBApxmPzICNQIGCAEBAwlZAQEhj?=
=?us-ascii?q?1IBAQ?=
IronPort-PHdr: =?us-ascii?q?9a23=3Azoin7h2ZoJEc0x7ksmDT+zVfTzU7u7jyIg8e44?=
=?us-ascii?q?YmjLQLSKm44pD+JxKFt/B9gUTAB8PH9v1egviQuryzEWAD4JPUtncEfdQMUh?=
=?us-ascii?q?IekswZkkQmB9LNEkz0KvPmLmQ6Ec1OWUUj/iS9Nk5YFQ=3D=3D?=
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-AV: E=Sophos;i="5.75,430,1589234400";
d="scan'208";a="31802088"
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
X-TUGAntiSpamFlag: ham
X-MGA-submission: =?us-ascii?q?MDGyfxEpnPaYza7keMUtsnlvCO0owBWuxjOxLp?=
=?us-ascii?q?WTcMXH8DZttbXlZI/19V5IJ3FNLQSnCUwmt+jN0MD34ZWuukeDgmydbG?=
=?us-ascii?q?EYsdR07SRwHeZYHseo2MBruquD6kHKVa9Uw9AgaMjD05cQvaM+ijTCX/?=
=?us-ascii?q?hK?=
Received: from eggs.gnu.org ([209.51.188.92]) by mxesa2.tugraz.at with
ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 03 Aug 2020 16:40:59 +0200
Received: from fencepost.gnu.org ([2001:470:142:3::e]:42986)
by eggs.gnu.org with esmtp (Exim 4.90_1)
(envelope-from <eliz@gnu.org>)
id 1k2be3-0005uu-6Z; Mon, 03 Aug 2020 10:40:55 -0400
Received: from [176.228.60.248] (port=3597 helo=home-c4e4a596f7)
by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
(Exim 4.82)
(envelope-from <eliz@gnu.org>)
id 1k2be2-0006rR-KX; Mon, 03 Aug 2020 10:40:54 -0400
Date: Mon, 03 Aug 2020 17:40:41 +0300
Message-Id: <837dufbxna.fsf@gnu.org>
From: Eli Zaretskii <eliz@gnu.org>
To: Leo Prikler <leo.prikler@student.tugraz.at>
Cc: 42694@debbugs.gnu.org
In-Reply-To: <66a57c1d0278d1e1117d2a81097635bfd63a9ebd.camel@student.tugraz.at>
(message from Leo Prikler on Mon, 03 Aug 2020 11:31:49 +0200)
Subject: Re: bug#42694: 26.3; Emacs crashes when linked against newer libx11
References: <66a57c1d0278d1e1117d2a81097635bfd63a9ebd.camel@student.tugraz.at>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

Toggle quote (15 lines)
> From: Leo Prikler <leo.prikler@student.tugraz.at>
> Date: Mon, 03 Aug 2020 11:31:49 +0200
>=20
> Two days ago, a patch was sent to Guix updating libx11 to a newer
> version in order to fix CVE-2020-14344. This causes a segmentation
> fault in Emacs when trying to start an X window. After invoking GDB, I
> found the offending line to be:
>=20
> /* Determine XIC style */
> xic_style =3D best_xim_style (FRAME_X_XIM_STYLES (f));
>=20
> For some reason, FRAME_X_XIM_STYLES (f) returns NULL here and
> best_xim_style fails when ARRAYELTS is called on it. I've attached a
> patch, that checks for this case.

Thanks, this is bug#42676, which was solved yesterday.


?
Your comment

This issue is archived.

To comment on this conversation send an email to 42680@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 42680
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help