]> git.eshelyaron.com Git - emacs.git/commitdiff
Prevent crashes caused by invalid locale coding systems
authorPo Lu <luangruo@yahoo.com>
Thu, 17 Feb 2022 07:35:41 +0000 (15:35 +0800)
committerPo Lu <luangruo@yahoo.com>
Thu, 17 Feb 2022 07:35:41 +0000 (15:35 +0800)
* src/xterm.c (handle_one_xevent): Prevent a signal inside
`setup_coding_system' which crashes recent versions of GLib if
the locale coding system is invalid.

Do not merge to master.

src/xterm.c

index b80d45f85525345f91d5c13b7c609f45faf00156..59413eafd48e17b8a8880c71e25ae7703236f466 100644 (file)
@@ -8739,6 +8739,15 @@ handle_one_xevent (struct x_display_info *dpyinfo,
              {
                /* Decode the input data.  */
 
+#ifdef HAVE_GLIB
+               /* If this isn't done in a build with GLib (usually
+                  with GTK), then the resulting signal in
+                  `setup_coding_system' will cause Emacs to
+                  crash.  */
+               if (NILP (Fcoding_system_p (coding_system)))
+                 coding_system = Qraw_text;
+#endif
+
                /* The input should be decoded with `coding_system'
                   which depends on which X*LookupString function
                   we used just above and the locale.  */