Repository navigation
Close the connection on an audio message shorter than 13 bytes - #239
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 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
33 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
bugfixnew-featureenhancementbreaking-changerefactordocumentationmaintenancecidependencies