Skip to content

ts: guard malformed borsh collection lengths#4305

Open
pradhankukiran wants to merge 1 commit intosolana-foundation:masterfrom
pradhankukiran:fix/ts-borsh-length-guards
Open

ts: guard malformed borsh collection lengths#4305
pradhankukiran wants to merge 1 commit intosolana-foundation:masterfrom
pradhankukiran:fix/ts-borsh-length-guards

Conversation

@pradhankukiran
Copy link

Fixes #2319

This hardens the shared TypeScript Borsh decoder against malformed collection lengths that can otherwise drive unbounded allocation or iteration from untrusted input.

Summary:

  • guard vec, vecU8/string, map, and array lengths before allocation or iteration
  • keep the public @anchor-lang/borsh API unchanged
  • add malformed-length regressions for accounts, types, instructions, events, fixed arrays, and direct borsh maps

Verification:

  • yarn build:node
  • yarn test

@vercel
Copy link

vercel bot commented Mar 10, 2026

@pradhankukiran is attempting to deploy a commit to the Solana Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@pradhankukiran pradhankukiran marked this pull request as ready for review March 10, 2026 16:23
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.

anchor-ts, parsing a vec: unchecked vec size allows unbounded allocation

1 participant