summaryrefslogtreecommitdiff
path: root/src/xfns.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-02-13 18:19:51 +0800
committerPo Lu <luangruo@yahoo.com>2022-02-13 18:20:42 +0800
commit6ed1994d277541035a507481aede6892bb55018c (patch)
treebbe969e0389a04d7637ff9b71ace4d54ad3c69f2 /src/xfns.c
parent242a2765d3970641887be7a6dedcc14b07fade7e (diff)
downloademacs-6ed1994d277541035a507481aede6892bb55018c.tar.gz
emacs-6ed1994d277541035a507481aede6892bb55018c.tar.bz2
emacs-6ed1994d277541035a507481aede6892bb55018c.zip
Prevent crashes from illegal locale coding systems
* src/xfns.c (xic_preedit_draw_callback): * src/xterm.c (handle_one_xevent): Don't pass invalid coding systems to `setup_coding_system'.
Diffstat (limited to 'src/xfns.c')
-rw-r--r--src/xfns.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/xfns.c b/src/xfns.c
index 02994e1b94f..c490dc1802a 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3198,6 +3198,14 @@ xic_preedit_draw_callback (XIC xic, XPointer client_data,
if (!output->preedit_active)
return;
+ /* If we don't bail out here then GTK can crash
+ from the resulting signal in `setup_coding_system'. */
+ if (NILP (Fcoding_system_p (Vlocale_coding_system)))
+ {
+ text = NULL;
+ goto im_abort;
+ }
+
if (call_data->text)
text = x_xim_text_to_utf8_unix (call_data->text, &text_length);
else