Skip to content

fix(node): prevent buffer decode detach race#34632

Merged
littledivy merged 2 commits into
mainfrom
orch/divybot-441
Jun 1, 2026
Merged

fix(node): prevent buffer decode detach race#34632
littledivy merged 2 commits into
mainfrom
orch/divybot-441

Conversation

@divybot

@divybot divybot commented May 31, 2026

Copy link
Copy Markdown
Contributor

Fix a reentrancy-sensitive Buffer decode path by parsing slice indexes before borrowing ArrayBufferView contents, then reacquiring the contents after any user-defined coercion can run. Mark the op reentrant because V8 integer coercion can execute JS and invoke other ops.

Add a unit-node regression that detaches the backing ArrayBuffer during utf8Slice index coercion and verifies the operation fails safely instead of using stale memory.

Tests:

  • cargo fmt --check
  • cargo build --bin deno
  • cargo test -p unit_node_tests --test unit_node -- buffer

Closes denoland/divybot#441

@divybot divybot changed the title Fix Buffer decode detach race fix(node): prevent buffer decode detach race May 31, 2026
Co-Authored-By: Divy Srivastava <[email protected]>
@littledivy
littledivy merged commit 95209b3 into main Jun 1, 2026
136 checks passed
@littledivy
littledivy deleted the orch/divybot-441 branch June 1, 2026 01:26
littledivy added a commit to crowlKats/deno that referenced this pull request Jun 10, 2026
Fix a reentrancy-sensitive Buffer decode path by parsing slice indexes
before borrowing ArrayBufferView contents, then reacquiring the contents
after any user-defined coercion can run. Mark the op reentrant because
V8 integer coercion can execute JS and invoke other ops.

Add a unit-node regression that detaches the backing ArrayBuffer during
utf8Slice index coercion and verifies the operation fails safely instead
of using stale memory.

Tests:
- cargo fmt --check
- cargo build --bin deno
- cargo test -p unit_node_tests --test unit_node -- buffer

Closes denoland/divybot#441

---------

Co-authored-by: divybot <[email protected]>
Co-authored-by: Divy Srivastava <[email protected]>
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