Skip to content

fix(payloads): SayText2 overflow#7

Merged
Rushaway merged 1 commit into
masterfrom
Rushaway-patch-1
Jun 27, 2026
Merged

fix(payloads): SayText2 overflow#7
Rushaway merged 1 commit into
masterfrom
Rushaway-patch-1

Conversation

@Rushaway

@Rushaway Rushaway commented Jun 27, 2026

Copy link
Copy Markdown
Member

Description

This PR fixes a runtime crash in SourceChatRelay when relayed chat/event messages exceed SayText2 byte limits after color/prefix formatting.

Background

Production logs showed exceptions from MoreColors at EndMessage with:

  • “SayText2 message content …”
  • “This message exceeded SayText2's maximum bytes allowed”

The failure happened in the receive path before broadcasting with CPrintToChatAll.

Root cause

The final rendered message length (prefix + colors + user text) could exceed SayText2 payload capacity. Existing sanitization removed unsupported multibyte characters, but did not enforce a strict byte budget on the final outgoing payload. #6

What changed

  1. Added a conservative payload cap constant
  2. Added UTF-8-safe byte clamping helper
  3. Added prefix-aware payload clamp helper
  4. Applied clamping in chat receive flow before broadcast
  5. Applied clamping in event receive flow before broadcast:

Behavior after fix

  • Messages that fit are unchanged.
  • Oversized messages are truncated safely (without breaking UTF-8 character boundaries).
  • Truncated content gets an ellipsis.
  • No SayText2 overflow exception is expected from this path.

Risk and compatibility

  • Low risk: change is scoped to inbound relay display formatting.
  • No protocol changes and no API changes.
  • Slightly more aggressive truncation is possible due to conservative safety margin, by design.

Testing notes

  • Verified static diagnostics: no editor-reported errors in the modified file.
  • Runtime expectation: reproducing the previous long-message case now results in a truncated broadcast instead of an exception.

@Rushaway Rushaway merged commit cffd765 into master Jun 27, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant