unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#42680] [PATCH] gnu: emacs: Ignore empty XIM styles.
@ 2020-08-02 18:46 ` Leo Prikler
  2020-08-03  7:21   ` Mathieu Othacehe
  2020-08-03 14:51   ` [bug#42680] Fwd: Re: bug#42694: 26.3; Emacs crashes when linked against newer libx11 Leo Prikler
  0 siblings, 2 replies; 5+ messages in thread
From: Leo Prikler @ 2020-08-02 18:46 UTC (permalink / raw)
  To: 42680

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

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




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#42680] [PATCH] gnu: emacs: Ignore empty XIM styles.
  2020-08-02 18:46 ` [bug#42680] [PATCH] gnu: emacs: Ignore empty XIM styles Leo Prikler
@ 2020-08-03  7:21   ` Mathieu Othacehe
  2020-08-03  9:35     ` Leo Prikler
  2020-08-03 14:51   ` [bug#42680] Fwd: Re: bug#42694: 26.3; Emacs crashes when linked against newer libx11 Leo Prikler
  1 sibling, 1 reply; 5+ messages in thread
From: Mathieu Othacehe @ 2020-08-03  7:21 UTC (permalink / raw)
  To: Leo Prikler; +Cc: 42680


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




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#42680] [PATCH] gnu: emacs: Ignore empty XIM styles.
  2020-08-03  7:21   ` Mathieu Othacehe
@ 2020-08-03  9:35     ` Leo Prikler
  2020-08-03 10:40       ` bug#42680: " Mathieu Othacehe
  0 siblings, 1 reply; 5+ messages in thread
From: Leo Prikler @ 2020-08-03  9:35 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 42680

Am Montag, den 03.08.2020, 09:21 +0200 schrieb Mathieu Othacehe:
> 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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#42680: [PATCH] gnu: emacs: Ignore empty XIM styles.
  2020-08-03  9:35     ` Leo Prikler
@ 2020-08-03 10:40       ` Mathieu Othacehe
  0 siblings, 0 replies; 5+ messages in thread
From: Mathieu Othacehe @ 2020-08-03 10:40 UTC (permalink / raw)
  To: Leo Prikler; +Cc: 42680-done


>> 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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#42680] Fwd: Re: bug#42694: 26.3; Emacs crashes when linked against newer libx11
  2020-08-02 18:46 ` [bug#42680] [PATCH] gnu: emacs: Ignore empty XIM styles Leo Prikler
  2020-08-03  7:21   ` Mathieu Othacehe
@ 2020-08-03 14:51   ` Leo Prikler
  1 sibling, 0 replies; 5+ messages in thread
From: Leo Prikler @ 2020-08-03 14:51 UTC (permalink / raw)
  To: 42680

[-- Attachment #1: Type: text/plain, Size: 95 bytes --]

It turns out, that this bug got fixed upstream independently using a
slightly different patch.

[-- Attachment #2: Weitergeleitete Nachricht – Re: bug#42694: 26.3; Emacs crashes when linked against newer libx11 --]
[-- Type: message/rfc822, Size: 3680 bytes --]

From: Eli Zaretskii <eliz@gnu.org>
To: Leo Prikler <leo.prikler@student.tugraz.at>
Cc: 42694@debbugs.gnu.org
Subject: Re: bug#42694: 26.3; Emacs crashes when linked against newer libx11
Date: Mon, 03 Aug 2020 17:40:41 +0300
Message-ID: <837dufbxna.fsf@gnu.org>

> From: Leo Prikler <leo.prikler@student.tugraz.at>
> Date: Mon, 03 Aug 2020 11:31:49 +0200
> 
> 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:
> 
>   /* Determine XIC style */
>   xic_style = best_xim_style (FRAME_X_XIM_STYLES (f));
> 
> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-08-03 14:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <837dufbxna.fsf@gnu.org>
2020-08-02 18:46 ` [bug#42680] [PATCH] gnu: emacs: Ignore empty XIM styles Leo Prikler
2020-08-03  7:21   ` Mathieu Othacehe
2020-08-03  9:35     ` Leo Prikler
2020-08-03 10:40       ` bug#42680: " Mathieu Othacehe
2020-08-03 14:51   ` [bug#42680] Fwd: Re: bug#42694: 26.3; Emacs crashes when linked against newer libx11 Leo Prikler

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).