Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

buffer: recreate pooled ArrayBuffer after transfer #61364

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

Open
lindsaycode05 wants to merge 1 commit into nodejs:main
base: main
Choose a base branch
Loading
from lindsaycode05:fix/buffer-transfer-pooled-ab

Conversation

@lindsaycode05
Copy link

@lindsaycode05 lindsaycode05 commented Jan 13, 2026

Fixes #61362

Summary

  • After a Buffer backed by the internal pool has its ArrayBuffer detached (e.g. via ArrayBuffer.prototype.transfer()), subsequent Buffer.from(..., 'base64') calls would throw ERR_BUFFER_OUT_OF_BOUNDS. This change ensures pooled Buffer creation doesn’t rely on a detached pool ArrayBuffer.

Repro

const base64 = Buffer.from('hello', 'utf8').toString('base64');
const first = Buffer.from(base64, 'base64');
first.buffer.transfer();
Buffer.from(base64, 'base64'); // threw `ERR_BUFFER_OUT_OF_BOUNDS` before, succeeds now

Changes

  • Add a pool-detachment guard before pooled allocations.
  • Add a regression test for pooled base64 Buffer.from after transfer.

Tests

  • python3 tools/test.py test/parallel/test-buffer-pool-untransferable.js
  • make -j4 test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

buffer Issues and PRs related to the buffer subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Can not construct Buffer after different Buffer was previously transfererd

AltStyle によって変換されたページ (->オリジナル) /