[dev] Re: [st] OSC-52 payload being truncated

From: Suraj N. Kurapati <sunaku_AT_riseup.net>
Date: Thu, 17 Aug 2017 23:40:34 -0700

On Tue, 15 Aug 2017 01:05:47 -0700, Suraj N. Kurapati wrote:
> I'm using st master at 7f990328e4fec8dfaaad311cb8af2304b58c872e where
> this OSC-52 payload is exceeding strescseq.buf's STR_BUF_SIZE length:
>
> printf
> '\033]52;;Rm9yIGRlYnVnZ2luZywgcnVubmluZyB0bXV4IHdpdGggLXYgb3IgLXZ2IHdpbGwgZ2VuZXJhdGUgc2VydmVyIGFuZCBjbGllbnQgbG9nCmZpbGVzIGluIHRoZSBjdXJyZW50IGRpcmVjdG9yeS4KCnRtdXggbWFpbGluZyBsaXN0cyBhcmUgYXZhaWxhYmxlLiBGb3IgZ2VuZXJhbCBkaXNjdXNzaW9uIGFuZCBidWcgcmVwb3J0czoKCiAgICAgICAgaHR0cHM6Ly9ncm91cHMuZ
> 29vZ2xlLmNvbS9mb3J1bS8jIWZvcnVtL3RtdXgtdXNlcnMKCkFuZCBmb3IgR2l0IGNvbW1pdCBlbWFpbHM6CgogICAgICAgIGh0dHBzOi8vZ3JvdXBzLmdvb2dsZS5jb20vZm9ydW0vIyFmb3J1bS90bXV4LWdpdAoKU3Vic2NyaWJlIGJ5IHNlbmRpbmcgYW4gZW1haWwgdG8gPHRtdXgtdXNlcnMrcw==\a'

I've written two patches to address this issue, which are attached
herein and available at https://github.com/sunaku/.st/compare/OSC-52

The first patch addresses the intolerance of linebreaks in base64dec():

    base64dec: skip non-printable characters like \r\n

    Non-printable characters, such as line breaks, in a base64 encoded
    string violate the "string length must be a multiple of four" rule.

    This patch pads the result buffer by one extra unit of four bytes,
    and skips over non-printable characters found in the input string.

The second patch expands strescseq.buf's length to support copying up
to 131k base64 (or 43k plain text) characters via the OSC-52 payload.

Please review these patches, optionally morphing them per your taste,
and add their functionality into st on behalf of tmux users like me.

Thanks for your consideration.



Received on Fri Aug 18 2017 - 08:40:34 CEST

This archive was generated by hypermail 2.3.0 : Fri Aug 18 2017 - 08:48:22 CEST