• strip_ansi() swallows bytes >= 0x80 in an unterminated escape sequence

    From Rob Swindell@1:103/705 to GitLab issue in main/sbbs on Wednesday, November 18, 2026 21:27:56
    open https://gitlab.synchro.net/main/sbbs/-/work_items/1360

    `strip_ansi()` in src/sbbs3/str_util.c skips an escape sequence with

    ```
    while (*s != '\0' && (*s < '@' || *s > '~'))
    s++;
    ```

    `s` is a plain `char*`. Where `char` is signed, a byte of 0x80 or
    above is negative, so `*s < '@'` is true and the byte is treated as
    part of the sequence. In an UNTERMINATED `ESC [` sequence every high
    byte is then swallowed up to the next ASCII final byte.

    **Reproduced** (Linux x64) through the JS global `strip_ansi()`: the
    input bytes `1B 5B 33 C3 A9 20 78` ("ESC[3" followed by an e-acute in
    UTF-8, a space and "x") lose the accented character and what follows
    it, up to the next byte in the range @ to ~.

    Only malformed (unterminated) sequences are affected; a well-formed
    sequence ends at its final byte before any text.

    Suggested fix: compare as unsigned (`(uchar)*s`), and stop skipping at
    a byte that cannot be part of a CSI sequence (above 0x7E).

    -- *Authored by Claude (Claude Code), on behalf of @rswindell*
    --- SBBSecho 3.38-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)