Repository navigation
fix(codecs-numbers): reject truncated and overlong shortU16 encodings #2067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lorisleiva
merged 7 commits into
anza-xyz:main
from
latent-9:fix-shortu16-decoder-bounds
Sep 22, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bc820fd
fix(codecs-numbers): reject truncated and overlong shortU16 encodings
latent-9 a3e06ae
chore: add changeset for shortU16 decoder fix
latent-9 74c71f1
fix(codecs-numbers): reject terminated 3-byte shortU16 over u16 + lin…
latent-9 bf1e130
test(codecs-numbers): exhaustive shortU16 decode contract coverage
latent-9 4f78974
fix(codecs-numbers): satisfy lint for shortU16 decoder-bounds tests
latent-9 bad233a
test(codecs-numbers): drop redundant exhaustive shortU16 decode tests
latent-9 fa6e525
fix(codecs-numbers): throw INVALID_BYTE_LENGTH for overlong shortU16 …
latent-9 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@solana/codecs-numbers': patch | ||
| --- | ||
|
|
||
| Fixed `getShortU16Decoder()` silently accepting malformed input: a truncated buffer decoded to garbage with an offset past the end of the byte array, and continuation chains longer than the documented three-byte encoding decoded to values outside the u16 domain. Malformed input now throws `SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH`, and decoded values above 65,535 now throw `SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE`, matching the guards every other number decoder already uses. |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.