public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "craig.ringer at 2ndquadrant dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug tapsets/25686] user_buffer_quoted incorrectly octal-escapes non-printable characters
Date: Tue, 17 Mar 2020 14:27:42 +0000	[thread overview]
Message-ID: <bug-25686-6586-Mmm3OXYdJk@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-25686-6586@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=25686

--- Comment #2 from Craig Ringer <craig.ringer at 2ndquadrant dot com> ---
Proposed patch attached

```
Author: Craig Ringer <craig@2ndquadrant.com>
Date:   Tue Mar 17 22:20:56 2020 +0800

    Fix ambiguous octal escapes in _stp_text_str

    Tapset functions like user_buffer_quoted that use the _stp_text_str
function
    for octal escaping would produce incorrect output if a null byte was
followed
    by a byte that represents a printable digit in US-ASCII. The null byte
would
    be emitted in the shorthand \0 form, then the printable digit would be
emitted
    literally, resulting in (e.g.) \06 instead of \0006 for the two input bytes
    "0x00 0x06".

    Fix by disabling shorthand escapes for null bytes. The alternatives are to:

    (a) look ahead in the buffer to see if the next byte is a digit and only
        expand the \0 to \000 if it would be ambiguous; or
    (b) octal-escape all printable digits

    The second would be woeful for the intended function of human-readable-ish
    buffer representations. The former seems potentially fragile and risky,
    so I just went with simple.

    Fixes bug #25686
```

-- 
You are receiving this mail because:
You are the assignee for the bug.

  parent reply	other threads:[~2020-03-17 14:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17 14:12 [Bug tapsets/25686] New: " craig.ringer at 2ndquadrant dot com
2020-03-17 14:27 ` [Bug tapsets/25686] " craig.ringer at 2ndquadrant dot com
2020-03-17 14:27 ` craig.ringer at 2ndquadrant dot com [this message]
2020-03-17 14:28 ` craig.ringer at 2ndquadrant dot com
2020-03-29 20:44 ` fche at redhat dot com

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

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

  git send-email \
    --in-reply-to=bug-25686-6586-Mmm3OXYdJk@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=systemtap@sourceware.org \
    /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.
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).