[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 6ed1994d27: Prevent crashes from illegal locale coding systems
From: |
Po Lu |
Subject: |
master 6ed1994d27: Prevent crashes from illegal locale coding systems |
Date: |
Sun, 13 Feb 2022 05:20:53 -0500 (EST) |
branch: master
commit 6ed1994d277541035a507481aede6892bb55018c
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
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'.
---
src/xfns.c | 8 ++++++++
src/xterm.c | 10 ++++++++++
2 files changed, 18 insertions(+)
diff --git a/src/xfns.c b/src/xfns.c
index 02994e1b94..c490dc1802 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
diff --git a/src/xterm.c b/src/xterm.c
index 50b7c9a606..fe213b0fab 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10024,6 +10024,11 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (nchars < nbytes)
{
+ /* If we don't bail out here then GTK can crash
+ from the resulting signal in `setup_coding_system'. */
+ if (NILP (Fcoding_system_p (coding_system)))
+ goto done_keysym;
+
/* Decode the input data. */
/* The input should be decoded with `coding_system'
@@ -11763,6 +11768,11 @@ handle_one_xevent (struct x_display_info *dpyinfo,
if (nchars < nbytes)
{
+ /* 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)))
+ goto xi_done_keysym;
+
/* Decode the input data. */
setup_coding_system (Vlocale_coding_system, &coding);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 6ed1994d27: Prevent crashes from illegal locale coding systems,
Po Lu <=