• src/syncterm/ripper.c

    From Deucе@1:103/705 to Git commit to main/sbbs/master on Sun Mar 15 22:51:39 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/5ca54e09393c1068e32e599f
    Modified Files:
    src/syncterm/ripper.c
    Log Message:
    Fix draw_button() off-by-one errors for exclusive box coordinates

    box.x2/y2 are exclusive (one past end), so:
    - Sunken border right/bottom highlight lines drew one pixel too far out
    - Recessed border width/height were one pixel too large, pushing the
    outer border off-screen for full-width buttons

    Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to Git commit to main/sbbs/master on Tue Mar 17 11:59:17 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/e9b4206eb16d93e29dd10df7
    Modified Files:
    src/syncterm/ripper.c
    Log Message:
    Replace dead argc check with malloc NULL check in do_skypix()

    The argc < 1 guard was unreachable because the counting loop always
    increments argc at least once. Replace it with a NULL check on the
    malloc() result, which was the actual missing guard.
    (Coverity CID 501977)

    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to Git commit to main/sbbs/master on Tue Mar 17 11:59:17 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/7350fd498615bb280d1244dd
    Modified Files:
    src/syncterm/ripper.c
    Log Message:
    Check fread() return when loading Amiga font in do_skypix()

    A short read would leave amiga_font partially uninitialized before
    the byte-swapping and offset validation that follows. Matches the
    existing fread check for the font list file earlier in the same
    function. (Coverity CID 501980)

    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to Git commit to main/sbbs/master on Sat Mar 21 19:53:02 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/6cce9286f030bf47bd57e6d5
    Modified Files:
    src/syncterm/ripper.c
    Log Message:
    Fix three |# (RIP_NO_MORE) parsing bugs in parse_rip()

    Bug reported by NightFox, who should really open bug reports on
    SourceForge instead of making people chase things down secondhand.

    1. Stale '!' rendered when |# follows non-RIP text

    When non-RIP bytes precede '!' in the same buffer (e.g. the common
    case of \n\r or \r\n line endings before a RIP line), rip_start is
    non-zero. The |# handler called handle_rip_line() which took its
    first branch: deferring the RIP data to pending, truncating blen to
    rip_start, and returning false. But the handler unconditionally ran
    rip_start = pos + 1, which now exceeded blen. At the end of
    parse_rip(), rip_start <= maxlen was true but rip_start > blen, so
    buffer_rip was skipped but rip_start was returned as the output
    length — reading the stale '!' byte from the physically-uncleared
    buffer position. Commit 27e6a20f added the rip_start <= blen guard
    to prevent a crash but did not fix the data leak.

    Fix: check handle_rip_line()'s return value. When it returns false
    (deferred), don't modify rip_start. When it returns true (processed
    immediately), do the post-processing as before. Also pass
    RIP_STATE_BANG instead of RIP_STATE_CMD since both paths want BANG
    state after |#.

    2. |# must flush immediately, even when deferred

    The entire purpose of the |# special handling (added in 93e05beb)
    is to flush RIP commands without waiting for a line terminator.
    When handle_rip_line() defers (returns false), the RIP data sits
    in pending unprocessed until the next parse_rip() call — defeating
    the flush semantics. This matters for interactive commands like
    the NY2008 popup (|1000) that block waiting for user input: the
    popup wouldn't appear until after the next data arrived.

    Fix: when handle_rip_line() returns false, process pending
    immediately via do_rip_string() and reset newstate to FLUSHING
    so the next flush call knows there's nothing left to process.

    3. |# bytes leak as visible text from moredata

    When handle_rip_line()'s first branch defers RIP data, remaining
    bytes after |# are saved to moredata. On the next parse_rip()
    call, the flush path processes pending and switches to moredata.
    But handle_rip_line() unconditionally resets rip_start to the
    sentinel (maxlen+1), even though the restored state (BANG) means
    the moredata buffer is entirely RIP data. With rip_start as
    sentinel, the |# handler's handle_rip_line() call took the second
    path with remove=0, failing to remove the |# bytes from the
    buffer. They were then returned to the caller as visible text.

    Fix: after the flush path switches to moredata, re-check the
    restored state. If it's not BOL/MOL (i.e. still inside a RIP
    sequence), reset rip_start to 0.

    4. Allow '!' to start new RIP sequence after |#

    Per the spec, |# means "end of RIPscrip scene." Testing against
    RIPterm (reference implementation) confirms that '!' after |# on
    the same line starts a new RIP sequence. SyncTERM's BANG state
    only accepted '|', sending '!' to unrip_line -> MOL where it was
    rejected as a RIP start character.

    Fix: accept '!', '\x01', and '\x02' in RIP_STATE_BANG, updating
    rip_start and staying in BANG. This matches RIPterm's behavior
    where both |#|#|# (repeated NO_MORE) and |#!|... (new sequence)
    work on the same line.

    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to Git commit to main/sbbs/master on Sat Mar 21 21:02:24 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/c438d8a8d55fcc325c3911af
    Modified Files:
    src/syncterm/ripper.c
    Log Message:
    Restrict post-|# bang acceptance to new RIP_STATE_NO_MORE state

    The '!' acceptance added in 6cce9286f0 was in RIP_STATE_BANG, which
    is also entered from BOL when the initial '!' is seen. This caused
    "!!|c04|..." to treat the second '!' as a new RIP sequence start
    instead of falling out of RIP parsing — the entire line should
    display as literal text since '!!' is not a valid RIP start.

    Add RIP_STATE_NO_MORE, entered only by |# (RIP_NO_MORE). Only this
    state accepts '!'/CTRL-A/CTRL-B for starting a new RIP sequence.
    RIP_STATE_BANG reverts to only accepting '|'.

    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to Git commit to main/sbbs/master on Wed Apr 1 23:54:25 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/679e5bae93abe08984256ab6
    Modified Files:
    src/syncterm/ripper.c
    Log Message:
    With the help of Claude, exactly match RIPTERM ellipses

    I had assumed they used McIlroy for Ellipses, so could only get
    close... they had actually used the two-region Bresenham, the reason
    I didn't get that to match was that they apparently scale by 100 to
    "avoid rounding", so my truncation was wildly different.
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to Git commit to main/sbbs/master on Thu Apr 2 01:31:45 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/d1c27d856bf669d666f637a8
    Modified Files:
    src/syncterm/ripper.c
    Log Message:
    And fix arcs too!

    We actually needed to extract the trig tables BGI uses to get this
    to work out right... fighting with floating point was not the way.
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to Git commit to main/sbbs/master on Thu Apr 2 15:55:01 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/7e79e2c43826ac8dedb24347
    Modified Files:
    src/syncterm/ripper.c
    Log Message:
    Much better bezier match

    replace per-iteration step/cnt division with accumulated
    t += 1.0/cnt.

    This produces the SAME ERROR I see from the RIPterm across obvious
    test vectors.

    The old code was "too correct", RIPterm appears to accumulate error
    and never correct for it.
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to Git commit to main/sbbs/master on Thu Apr 2 18:19:25 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/81b7dd81d2a640500ae7961f
    Modified Files:
    src/syncterm/ripper.c
    Log Message:
    Mostly cleanup stuff...

    Clean up old use of a hack bit, use the new polyfill for the RIP
    command, clean up some comments, and get XOR working properly
    everywhere.
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to Git commit to main/sbbs/master on Thu Apr 2 19:20:37 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/179725429e08522795487d5f
    Modified Files:
    src/syncterm/ripper.c
    Log Message:
    Some more button fixups.

    1. !|1U missing <res> field - no longer draws the button (per RIPterm)
    2. Recessed inner corner pixels - removed explicit cc-colored corner
    pixels on inner recess border (RIPterm lets the bg lines overlap naturally) 3. Chisel inset height off-by-one — y2 - y1 + 1 → y2 - y1 since box.y2 is
    exclusive
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to Git commit to main/sbbs/master on Thu Apr 2 22:12:09 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/fadd8eb62fe426eee68a0964
    Modified Files:
    src/syncterm/ripper.c
    Log Message:
    Handle thick ellipses better.

    It looks like when drawing a thick ellipse, it draws multiple thick
    line segments. Now that we have the Borland cos/sin tables, we can
    do that ourselves as a special case.
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to Git commit to main/sbbs/master on Fri Apr 3 08:52:32 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/9684acff780621441b3c1194
    Modified Files:
    src/syncterm/ripper.c
    Log Message:
    Fix parse_mega() buffer overreads

    Many places were calling parse_mega() without checking the return
    value, then calling parse_mega() on the string AFTER the previous
    one. This means that on truncated invalid RIP sequences, ripper
    would read past the end of the allocation.

    This fix was complicated by the fact that the "last" item in a
    parameter list can be truncated as long as it has at least one
    valid byte in it.

    This now uses a vararg function and parses them all at once (mostly).
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)