unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: v.schneidermann@gmail.com, 27270@debbugs.gnu.org,
	npostavs@users.sourceforge.net
Subject: bug#27270: display-raw-bytes-as-hex generates ambiguous output for Emacs strings
Date: Sun, 24 Apr 2022 15:35:53 -0700	[thread overview]
Message-ID: <04ac11a4-91a6-00f9-1a12-07e5f62b46b4@cs.ucla.edu> (raw)
In-Reply-To: <87sfq2d8qi.fsf@gnus.org>

On 4/24/22 04:24, Lars Ingebrigtsen wrote:

> The likelihood of anybody actually encountering this issue is ... small.

Sure, if strings are random. But strings from opponents aren't random.

I'll readily grant that it's a much smaller exposure than SQL injection. 
Still, like SQL injection it's an exposure and should be fixed.


> You want to quote all %c as if they were raw bytes?  Or only following a
> raw byte?

Closer to the latter, but even less than the latter. I am being 
conservative and am proposing that Emacs do what it does now unless the 
resulting output would be misinterpreted on input. So I wouldn't change 
how all characters are quoted; only how characters are quoted when the 
result would be interpreted incorrectly.


> what about (format "%cf" #x9e)

Since that returns a multibyte string, I suggest "\u009ef" which is 
multibyte. For its unibyte counterpart (encode-coding-string (format 
"%cf" #x9e) 'iso-latin-1) I suggest the syntax "\x9e\ f" which is 
unibyte. (These are not the only possibilities; for example, the former 
could be "\u009e\ f" if you think that's clearer.)

This string syntax is already supported by Emacs, so this wouldn't 
change the Lisp reader.


> it creates
> very confusing displayed strings.

These examples are not *that* confusing. And although they may not be 
beautiful, correct strings are less confusing than incorrect strings.





  reply	other threads:[~2022-04-24 22:35 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-07  3:57 bug#27270: display-raw-bytes-as-hex generates ambiguous output for Emacs strings Paul Eggert
2017-06-07  5:17 ` Eli Zaretskii
2017-06-08  0:49   ` Paul Eggert
2017-06-08  1:07     ` npostavs
2017-06-08 15:20       ` Eli Zaretskii
2017-06-08 15:56       ` Paul Eggert
2017-06-08 16:11         ` Eli Zaretskii
2017-06-08 16:24           ` Paul Eggert
2017-06-08 18:59             ` Eli Zaretskii
2017-06-08 19:43               ` Paul Eggert
2017-06-08 19:56                 ` Eli Zaretskii
2017-06-08 20:35                   ` Paul Eggert
2017-06-09  6:00                     ` Eli Zaretskii
2017-06-09 23:44                       ` Paul Eggert
2017-06-10  7:24                         ` Eli Zaretskii
2017-06-11  0:04                           ` Paul Eggert
2017-06-11 14:48                             ` Eli Zaretskii
2017-06-11 17:26                               ` Paul Eggert
2017-09-02 13:25                                 ` Eli Zaretskii
2022-04-23 14:00                         ` Lars Ingebrigtsen
2022-04-24  7:10                           ` Paul Eggert
2022-04-24  9:56                             ` Vasilij Schneidermann
2022-04-24 10:26                               ` Andreas Schwab
2022-04-24 10:51                                 ` Vasilij Schneidermann
2022-04-24 11:01                                   ` Andreas Schwab
2022-04-24 11:29                                     ` Lars Ingebrigtsen
2022-04-24 22:46                               ` Paul Eggert
2022-04-24 11:24                             ` Lars Ingebrigtsen
2022-04-24 22:35                               ` Paul Eggert [this message]
2022-04-25  7:40                                 ` Lars Ingebrigtsen
2022-04-25 16:49                                   ` Paul Eggert
2022-04-26 10:06                                     ` Lars Ingebrigtsen
2022-04-26 16:48                                       ` Paul Eggert
2022-04-27 12:13                                         ` Lars Ingebrigtsen
2022-04-27 17:21                                           ` Paul Eggert
2022-04-27 17:22                                             ` Lars Ingebrigtsen
2022-04-28 17:58                                               ` Paul Eggert
2017-06-10 22:52         ` npostavs
2017-06-11  0:10           ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=04ac11a4-91a6-00f9-1a12-07e5f62b46b4@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=27270@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=npostavs@users.sourceforge.net \
    --cc=v.schneidermann@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).