• src/sbbs3/ansi_parser_test.cppsrc/sbbs3/ansi_parser.cpp ansi_parser.h

    From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Thursday, September 24, 2026 21:22:48
    https://gitlab.synchro.net/main/sbbs/-/commit/cd63a8361e7f262904965e89
    Added Files:
    src/sbbs3/ansi_parser_test.cpp
    Modified Files:
    src/sbbs3/ansi_parser.cpp ansi_parser.h ansi_terminal.cpp ansi_terminal.h con_out.cpp terminal.h
    Log Message:
    Handle bulk control strings without stalling or bloating output state

    Three fixes to the terminal output path, none of them specific to any one control string. They also cover the graphics blob APCs that cterm_lib.js already writes through console.write().

    ANSI_Parser now caps ansi_sequence at 1KB and counts the remainder in sequence_overflow. A megabyte-scale APC or DCS payload was appended byte
    by byte to a std::string that nothing reads except the broken-sequence
    warning, which would then have logged the whole payload. The warning
    reports the true length and marks a truncated sample. Every append site
    goes through one helper, so the cap is an invariant rather than a
    property of the string state alone.

    Control-string payload no longer enters the terminal line buffer, which
    is sized and intended for displayable text.

    Terminal gains suspend_output_rate()/restore_output_rate(), for use
    around a bulk payload. SyncTERM's rate emulation gates every byte off
    the wire, so a 200KB payload at an emulated 2400bps would otherwise take
    about eleven minutes. This covers only a rate the BBS set itself; a rate
    the user configured in their client is neither visible nor reachable
    from here.

    ansi_parser_test.c exercises the cap, including that a capped string
    still reaches its terminator and that an illegal byte in one is still
    detected.

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

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