From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D41CD3871029; Tue, 17 Mar 2020 14:27:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D41CD3871029 From: "craig.ringer at 2ndquadrant dot com" 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 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: systemtap X-Bugzilla-Component: tapsets X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: craig.ringer at 2ndquadrant dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: systemtap at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: systemtap@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Systemtap mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Mar 2020 14:27:42 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D25686 --- Comment #2 from Craig Ringer --- Proposed patch attached ``` Author: Craig Ringer 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 b= ytes "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 ``` --=20 You are receiving this mail because: You are the assignee for the bug.=