Skip to content

Close the connection on an audio message shorter than 13 bytes - #239

Merged
maximmaxim345 merged 1 commit into
mainfrom
fix/close-on-short-audio-message
Nov 6, 2026
Merged

maximmaxim345 merged 1 commit into
mainfrom
fix/close-on-short-audio-message

Conversation

@maximmaxim345

Copy link
Copy Markdown
Member

What does this implement/fix?

An audio message shorter than 13 bytes went to the decoder. Under 9 bytes it threw an unhandled rejection, and from 9 to 12 bytes it played as empty audio.

The spec makes this a protocol error, so the player now logs a warning and closes the connection, like it does for other protocol errors. Only non-compliant servers send these messages.

Related issue or spec PR (if applicable):

Types of changes

  • Bugfix (non-breaking change which fixes an issue): bugfix
  • New feature (non-breaking change which adds functionality): new-feature
  • Enhancement to an existing feature: enhancement
  • Breaking change (changes the public API or the protocol in a way that is not backwards compatible): breaking-change
  • Refactor (no behavior change): refactor
  • Documentation only: documentation
  • Maintenance / chore: maintenance
  • CI / workflow change: ci
  • Dependencies bump: dependencies

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the change that rejects undersized audio messages before decoding.

No open issues 🎉

What changed in this PR

Rejects undersized audio messages before decoding, treating them as protocol errors rather than allowing decoding failures or empty playback.

Changes:

  • Logs a warning and closes the connection when an audio message is shorter than 13 bytes.
  • Adds a regression test confirming that a 12-byte audio message closes the connection without reaching the decoder.
File Description
tests/​unit/​core.test.ts Tests connection closure and decoder bypass for an undersized audio message.
src/​core/​core.ts Adds the minimum-length check before audio decoding.

Review effort: Balanced

@maximmaxim345
maximmaxim345 merged commit 23c6e18 into main Nov 6, 2026
4 checks passed
@maximmaxim345
maximmaxim345 deleted the fix/close-on-short-audio-message branch November 6, 2026 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants