• src/sbbs3/ansi_parser_tes

    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/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
  • 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/4f775730ab376980e6cde57c
    Modified Files:
    src/sbbs3/ansi_parser_test.cpp atcodes.cpp putmsg.cpp termaudio_cache.cpp
    Log Message:
    Emit pass-through control sequences from the source, not the parser copy

    putmsg() re-emitted a control sequence to the client by writing ANSI_Parser::ansi_sequence, which is now capped at 1KB. A sixel image or
    a font-loading DCS larger than that in a display file or a message was
    sent truncated, without its terminator, leaving the client inside a
    control string and swallowing everything that followed until some
    unrelated terminator appeared. Nothing was logged, because the path
    reaching that code is a completed sequence rather than a broken one.

    The sequence is now written from the caller's own buffer, recording the
    offset where it began. That is independent of the cap and avoids a copy.

    Also from the same review:

    The C;L query is issued with output-rate emulation suspended. It was
    paced by the emulated rate like any other output, so on a rate-limited
    session the reply missed its timeout and the client cache was recorded
    empty for the rest of the session, making every sound re-upload.

    Reading an APC reply no longer clears a pending abort. clearabort() also
    zeroes the line counter, so a user who pressed Ctrl-C during a display
    file had it swallowed and the pause counter reset.

    The size cap is compared in off_t. Truncating to uint32_t let a file of
    4GiB or more pass the check and then be read and base64-encoded whole.

    @MUSICOFF: clamps its fade argument. A negative value became a fade of
    about fifty days, so the code that stops the music did not.

    The per-path warning list is bounded. @-codes are reachable from message
    text on a sub-board whose n_pmode clears P_NOATCODES, so a single post
    naming many distinct missing files could otherwise grow it without limit.

    Reading an APC reply also has an overall deadline rather than only a
    per-byte timeout, and the line-buffer suspension around an upload is
    saved and restored rather than assumed.

    Co-Authored-By: Claude Opus 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/12d817c0b81a049f4434b5bf
    Modified Files:
    src/sbbs3/ansi_parser_test.cpp ansi_terminal.cpp ansi_terminal.h con_out.cpp terminal.h
    Log Message:
    Keep whole control strings out of the line buffer

    restoreline() replays the line buffer to redraw a line after, for
    example, a node message interrupts it. The line buffer already skipped
    the body of a DCS/OSC/PM/APC string, but kept its "ESC _" introducer and
    the final byte of its terminator. Replaying those opens a string the
    terminal never sees closed, so it swallows all following output: an
    @SOUND: in a prompt, followed by an incoming node message, was enough.

    term_out() now records where each sequence begins in the line buffer and
    rolls the buffer back to that point when a sequence completes, or breaks, having been a control string. CSI sequences are left in place, so
    restoreline() still restores colors.

    ansi_parser_test.cpp pins the parser states this depends on.

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

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