public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug tapsets/25686] New: user_buffer_quoted incorrectly octal-escapes non-printable characters
@ 2020-03-17 14:12 craig.ringer at 2ndquadrant dot com
  2020-03-17 14:27 ` [Bug tapsets/25686] " craig.ringer at 2ndquadrant dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: craig.ringer at 2ndquadrant dot com @ 2020-03-17 14:12 UTC (permalink / raw)
  To: systemtap

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

            Bug ID: 25686
           Summary: user_buffer_quoted incorrectly octal-escapes
                    non-printable characters
           Product: systemtap
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tapsets
          Assignee: systemtap at sourceware dot org
          Reporter: craig.ringer at 2ndquadrant dot com
  Target Milestone: ---

`user_buffer_quoted` omits leading zeroes from octal escapes even when the next
character is a printable digit. This leads to incorrectly escaped data.

E.g. given the buffer `1\x006\x00` i.e. hex-representation `31 00 36 00`,
`user_buffer_quoted` will emit `1\06\0`. This will decode to hex-bytes `31 06
00` because the sequence `\06` is interpreted as "octal 06" not "octal 0, then
ascii printable digit 6".

The underlying bug appears to be in `_stp_text_str`.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tapsets/25686] user_buffer_quoted incorrectly octal-escapes non-printable characters
  2020-03-17 14:12 [Bug tapsets/25686] New: user_buffer_quoted incorrectly octal-escapes non-printable characters craig.ringer at 2ndquadrant dot com
@ 2020-03-17 14:27 ` craig.ringer at 2ndquadrant dot com
  2020-03-17 14:27 ` craig.ringer at 2ndquadrant dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: craig.ringer at 2ndquadrant dot com @ 2020-03-17 14:27 UTC (permalink / raw)
  To: systemtap

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

--- Comment #1 from Craig Ringer <craig.ringer at 2ndquadrant dot com> ---
Created attachment 12383
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12383&action=edit
Proposed patch to fix ambiguous octacl escapes

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tapsets/25686] user_buffer_quoted incorrectly octal-escapes non-printable characters
  2020-03-17 14:12 [Bug tapsets/25686] New: user_buffer_quoted incorrectly octal-escapes non-printable characters 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
  2020-03-17 14:28 ` craig.ringer at 2ndquadrant dot com
  2020-03-29 20:44 ` fche at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: craig.ringer at 2ndquadrant dot com @ 2020-03-17 14:27 UTC (permalink / raw)
  To: systemtap

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tapsets/25686] user_buffer_quoted incorrectly octal-escapes non-printable characters
  2020-03-17 14:12 [Bug tapsets/25686] New: user_buffer_quoted incorrectly octal-escapes non-printable characters 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
@ 2020-03-17 14:28 ` craig.ringer at 2ndquadrant dot com
  2020-03-29 20:44 ` fche at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: craig.ringer at 2ndquadrant dot com @ 2020-03-17 14:28 UTC (permalink / raw)
  To: systemtap

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

Craig Ringer <craig.ringer at 2ndquadrant dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://sourceware.org/bugz
                   |                            |illa/show_bug.cgi?id=11277

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tapsets/25686] user_buffer_quoted incorrectly octal-escapes non-printable characters
  2020-03-17 14:12 [Bug tapsets/25686] New: user_buffer_quoted incorrectly octal-escapes non-printable characters craig.ringer at 2ndquadrant dot com
                   ` (2 preceding siblings ...)
  2020-03-17 14:28 ` craig.ringer at 2ndquadrant dot com
@ 2020-03-29 20:44 ` fche at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: fche at redhat dot com @ 2020-03-29 20:44 UTC (permalink / raw)
  To: systemtap

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

Frank Ch. Eigler <fche at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fche at redhat dot com
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Frank Ch. Eigler <fche at redhat dot com> ---
Thanks for your patience, merged!

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-03-29 20:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-17 14:12 [Bug tapsets/25686] New: user_buffer_quoted incorrectly octal-escapes non-printable characters 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
2020-03-17 14:28 ` craig.ringer at 2ndquadrant dot com
2020-03-29 20:44 ` fche at redhat dot com

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).