Subject: bug#42673: 26.3; Return value of XGetIMValues not checked in xim_open_dpy (src/xterm.c)

From: Eli Zaretskii <[email-masked]>
Date: Sun, 02 Aug 2020 20:23:36 +0300

merge 42673 42676 42677
thanks

> From: Yichao Yu <[email-masked]>
> Date: Sun, 2 Aug 2020 09:22:53 -0400
> Cc: Yichao Yu <[email-masked]>
> 
> The call in question is at
> https://git.savannah.gnu.org/cgit/emacs.git/tree/src/xterm.c?id=9fe2bdb88a4ebd4b2286c1c2a2a2ba7411af01b6#n10316
> Since the return value isn't checked, a failure to initialize here can
> cause `dpyinfo->xim_styles` to be `NULL` which intern cause readers
> like https://git.savannah.gnu.org/cgit/emacs.git/tree/src/xfns.c?id=9fe2bdb88a4ebd4b2286c1c2a2a2ba7411af01b6#n2659
> to pass a `NULL` pointer to `best_xim_style` and crash.
> 
> The fix is to check if the return value of `XGetIMValues` is not
> `NULL` and if it is not `NULL`, disable XIM.

Thanks, other people also reported this, so this is now fixed on the
emacs-27 branch.