• src/sbbs3/ansi_parser.cpp

    From Rob Swindell (on Debian L@VERT to Git commit to main/sbbs/m on Thu Sep 24 21:22:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/2cbb0c02efb8a0cc02e14d6e
    Modified Files:
    src/sbbs3/ansi_parser.cpp ansi_parser.h ansi_parser_test.cpp
    Log Message:
    ANSI_Parser: cap CSI parameters and intermediate bytes

    ansi_sequence was already limited to max_sequence_len (1024) bytes, but ansi_params and ansi_ibs grew without limit. The terminal output path
    parses every byte sent to the user, and handle_SGR_sequence() calls
    get_pval() once per parameter, each call copying and rescanning the whole parameter string: cubic in the sequence length. A single 40 KB SGR
    sequence in a message took about 53 seconds of CPU to display, per reader.

    Parameter and intermediate bytes past the cap are now dropped and the
    sequence completes normally. It isn't treated as broken, because putmsg() prints the rest of a broken sequence as text. The filters putmsg() applies
    look only at the final byte, the first parameter byte, exact intermediate strings and the start of ansi_sequence, so truncation doesn't change what
    it strips.

    Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Debian L@VERT to Git commit to main/sbbs/m on Thu Sep 24 21:22:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/64f8ea71ff6847c3ff81b656
    Modified Files:
    src/sbbs3/ansi_parser.cpp ansi_parser_test.cpp
    Log Message:
    ANSI_Parser: end an SOS string on its string terminator

    ESC \ inside an SOS string moved the parser to the ESC state instead of completing the sequence, so the byte after the terminator was parsed as
    though it followed an ESC. A CR or LF there (the usual case) made the
    sequence broken and putmsg() stripped the whole SOS; a printable
    character was swallowed as the sequence's final byte; an escape sequence following it was lost track of. This dates from 374282bf81
    (skins-28-shop, 2025-03-30).

    ESC \ now completes an SOS exactly as it completes an APC, DCS, OSC or PM string: final state, ansi_was_cc set, final byte '\'.

    Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net