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.bugs Subject: bug#74922: Fwd: bug#74922: 29.4; copy_string_contents doesn't always produce a valid utf-8 Date: Tue, 17 Dec 2024 16:24:13 +0200 Message-ID: <8634imo0aa.fsf@gnu.org> References: <86msguo3cg.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25318"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74922@debbugs.gnu.org To: Evgeny Kurnevsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 17 15:25:19 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1tNYVj-0006Se-BS for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Dec 2024 15:25:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNYVV-00073w-Q4; Tue, 17 Dec 2024 09:25:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNYVU-00072R-FB for bug-gnu-emacs@gnu.org; Tue, 17 Dec 2024 09:25:04 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNYVU-0004Cv-5t for bug-gnu-emacs@gnu.org; Tue, 17 Dec 2024 09:25:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=20ro7N241Oa++eVcX0skEXHwB77tYt/jmub6b6t2VFA=; b=unOpJ0SSKn2urNQ0IEtTo/tPhCsGK55NncxudhtLZVTtTYv2QnNlfQZALYF/y3GpBWgQor8mj6bLJ2r2O31DCXM6wEPYTK/ud0lPIkTOhkQmM3/hp6ouDwf4uiZsjr0VmKGQVpmdc/mzSvJHtcEawJjoKHstHZWH73dnQkzKyHxkbtLpE2eOo3geYmb6BfrmXHC4v7MB65VqgUI4rDFQtPoD1xC7QamSFlFk5I+POq/27FzY+Gmzb4xyuSrBGhKqorwzbcTxIza2cAbCVJpLJEHIe8RA2evZsIDriSBj+2Os9YHy8kgLnVcQtHDzD3uRA54b90/woLkCOd3zhioxPA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tNYVT-0002GQ-Bt for bug-gnu-emacs@gnu.org; Tue, 17 Dec 2024 09:25:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Dec 2024 14:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74922 X-GNU-PR-Package: emacs Original-Received: via spool by 74922-submit@debbugs.gnu.org id=B74922.17344454808632 (code B ref 74922); Tue, 17 Dec 2024 14:25:02 +0000 Original-Received: (at 74922) by debbugs.gnu.org; 17 Dec 2024 14:24:40 +0000 Original-Received: from localhost ([127.0.0.1]:58223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tNYV4-0002F9-UO for submit@debbugs.gnu.org; Tue, 17 Dec 2024 09:24:39 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:59390) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tNYUv-0002Ek-AM for 74922@debbugs.gnu.org; Tue, 17 Dec 2024 09:24:31 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNYUp-000413-8H; Tue, 17 Dec 2024 09:24:23 -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=20ro7N241Oa++eVcX0skEXHwB77tYt/jmub6b6t2VFA=; b=ad4wj91heifu bohSuZi/vbdmP0sbg9jU9OLWuq+LzooRdmr3cqsoaqUQ1M85XGrJdHTPTKCHo0vuU5J8lSgr8V4tf IVJYqAQqFAgjw9fOqkwA3DZ9jL/W9ArPUa7GbWJTMjkGDLnRKEpLtp49nKpjflxSD8nMD0B2/1xVL vfVbr6Xh8ALIv69QRXu3C7oDxpJQ0QEp5Es/ZPtMiX/ymrOFElgctNgVLNkii5ZR06FfNfl3hh7AD X7lpRnREnw3MbfNirQXcq0H0/Upj016wEd1EvXQfITwCU9utjw/ye22+kPt/AMq6v3z5Qpvnjpl+B 1j62+8x7XU9srdqrjCZY+w==; In-Reply-To: (message from Evgeny Kurnevsky on Tue, 17 Dec 2024 13:31:57 +0000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:297299 Archived-At: > From: Evgeny Kurnevsky > Date: Tue, 17 Dec 2024 13:31:57 +0000 > > Yes, that's a binary file that is not an utf-8 string. From the comment in module_copy_string_contents > implementation I guessed that in such cases emacs should signal an error, but instead it just passes this > invalid string to the dynamic library which caused this bug in emacs-module-rs (see > https://ubolonton.github.io/emacs-module-rs/latest/type-conversions.html#strings ). So if it's expected then > maybe it should be explicitly said in the docs of copy_string_contents here > https://www.gnu.org/software/emacs/manual/html_node/elisp/Module-Values.html ? It just says that it stores > the utf-8 encoded text which makes an impression that it's an always valid utf-8 string. I could look into the internals, but I actually wonder why the module doesn't check the text before relying on such subtle behaviors. We didn't document the fact that it signals an error for a reason. So: why cannot the module code or the application which uses it test up from that the string it copies is human-readable text, nit some binary junk?