SIGN IN SIGN UP
denoland / deno UNCLAIMED

A modern runtime for JavaScript and TypeScript.

0 0 2 Rust

fix(ext/node): fix Buffer.concat, expose internal/buffer, implement markAsUntransferable (#32760)

## Summary

Fixes 3 Buffer compat tests from #32706 and fixes #31824.

- **Buffer.concat**: Use `TypedArrayPrototypeGetByteLength` instead of
`.length` to prevent spoofed length getters from causing uninitialized
memory exposure
- **internal/buffer**: Register as a requireable internal module and
export `utf8Write`
- **markAsUntransferable**: Implement using V8's `set_detach_key` API.
Applied to the Buffer pool so `ArrayBuffer.prototype.transfer()` throws
`TypeError` instead of detaching the shared pool. This prevents the bug
where transferring a Buffer's backing store would break all subsequent
`Buffer.from()` calls (#31824)

### Enabled tests
- `test-buffer-concat.js`
- `test-buffer-write-fast.js`
- `test-buffer-pool-untransferable.js`

Closes #31824

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
B
Bartek Iwańczuk committed
6aa3354a7faa644abe89bdcb66c04fde72830cd3
Parent: e4ae311
Committed by GitHub <noreply@github.com> on 3/17/2026, 9:09:27 PM