Skip to content

fix(ext/node): respect base64 buffer ranges#36030

Merged
nathanwhit merged 2 commits into
denoland:mainfrom
nathanwhit:fix/base64-buffer-ranges
Jul 14, 2026
Merged

fix(ext/node): respect base64 buffer ranges#36030
nathanwhit merged 2 commits into
denoland:mainfrom
nathanwhit:fix/base64-buffer-ranges

Conversation

@nathanwhit

Copy link
Copy Markdown
Member

Summary

  • validate internal base64 slice and write ranges before invoking native operations
  • limit base64 decoding to the caller-requested destination span
  • make the underlying base64 operations reject invalid ranges consistently

The base64 write path previously decoded into the full remaining buffer and only clamped the returned byte count afterward. This change bounds the destination view before decoding and adds range checks at both the JavaScript adapter and native operation layers.

Testing

  • cargo build --bin deno
  • target/debug/deno test -A --config tests/config/deno.json tests/unit_node/buffer_test.ts
  • ./tools/format.js
  • cargo fmt --check --package deno_web --package deno_node

@nathanwhit
nathanwhit marked this pull request as ready for review July 14, 2026 02:44
@bartlomieju bartlomieju changed the title fix(node): respect base64 buffer ranges fix(ext/node): respect base64 buffer ranges Jul 14, 2026
@nathanwhit
nathanwhit merged commit fcfcfd2 into denoland:main Jul 14, 2026
269 of 271 checks passed
bartlomieju pushed a commit that referenced this pull request Jul 15, 2026
## Summary

- validate internal base64 slice and write ranges before invoking native
operations
- limit base64 decoding to the caller-requested destination span
- make the underlying base64 operations reject invalid ranges
consistently

The base64 write path previously decoded into the full remaining buffer
and only clamped the returned byte count afterward. This change bounds
the destination view before decoding and adds range checks at both the
JavaScript adapter and native operation layers.

## Testing

- `cargo build --bin deno`
- `target/debug/deno test -A --config tests/config/deno.json
tests/unit_node/buffer_test.ts`
- `./tools/format.js`
- `cargo fmt --check --package deno_web --package deno_node`
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.

2 participants