From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: master 6ed1994d27: Prevent crashes from illegal locale coding systems Date: Sun, 13 Feb 2022 15:45:36 +0200 Message-ID: <837d9yribj.fsf@gnu.org> References: <83czjqrkew.fsf@gnu.org> <874k52kiu4.fsf@yahoo.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13770"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Feb 13 14:48:02 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJFEQ-0003Mq-GC for ged-emacs-devel@m.gmane-mx.org; Sun, 13 Feb 2022 14:48:02 +0100 Original-Received: from localhost ([::1]:34860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nJFEO-0008Qm-RN for ged-emacs-devel@m.gmane-mx.org; Sun, 13 Feb 2022 08:48:00 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44786) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJFC8-0007UE-4N for emacs-devel@gnu.org; Sun, 13 Feb 2022 08:45:40 -0500 Original-Received: from [2001:470:142:3::e] (port=35842 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJFC7-0000t5-Qr; Sun, 13 Feb 2022 08:45:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=SZkKJPtpaGFtcCO167JxlOGAPREEr6WT2Lv/niSBSug=; b=KfN9eKbUTpc3 x/1l8tkGrUll0QGuxB/UYmxO+233aEyxtjXHK1IfuO4dQKAfWpahJuX00xDoYS1MX0HoUvaOs5nu0 qRa64J314RgNCE2QSayXG6gMmBgzNWLNu7a0YJc1OvX126Z0BuFtA2JV+X71kBOgWvw9J2Ad2J0p+ hJ0b1uZpX7AzY6HS7wEbKjK1Axn0YoY4IkEgEu6POuvzS7JTr5rElRebcoQm6k7Rv4YcD3LTYpbu9 h46Q0HfEw1Xfolvtq/IpXPH787iYYvFmNTdkCMCrw0OTelAYHkeDWC5gb+BGuDcjY2apKvnwQzNBR 7q7vmOV+5WtFQNISqU0QxQ==; Original-Received: from [87.69.77.57] (port=1078 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJFC7-0004lV-8f; Sun, 13 Feb 2022 08:45:39 -0500 In-Reply-To: <874k52kiu4.fsf@yahoo.com> (message from Po Lu on Sun, 13 Feb 2022 21:16:19 +0800) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:286213 Archived-At: > From: Po Lu > Cc: emacs-devel@gnu.org > Date: Sun, 13 Feb 2022 21:16:19 +0800 > > Decoding multibyte X keyboard input and XIM pre-edit text with any > coding system other than the actual locale coding system will result in > nonsensical text. But even nonsensical text is better than no text at all, don't you agree? And anyway, in what possible encodings could this text be? Can't we detect the encoding with reasonable success rate? I mean, dropping input on the floor, let alone doing that silently, is pretty rough, no? > > And how come locale-coding-system is not a valid coding-system there > > in the first place? > > The user could have set it to an invalid value, which leads to > spectacular crashes when setup_coding_system signals inside a GTK event > filter. Can't we catch those signals? If we cannot catch these signals, it probably means it is unsafe to call decoding routines in that place anyway.