Skip to content

Comments

Fix #55422: Buffer.concat and Buffer.copy silently produce invalid r#61914

Open
danielalanbates wants to merge 1 commit intonodejs:mainfrom
danielalanbates:fix/issue-55422
Open

Fix #55422: Buffer.concat and Buffer.copy silently produce invalid r#61914
danielalanbates wants to merge 1 commit intonodejs:mainfrom
danielalanbates:fix/issue-55422

Conversation

@danielalanbates
Copy link

@danielalanbates danielalanbates commented Feb 21, 2026

Fixes: #55422

Summary

This PR fixes: Buffer.concat and Buffer.copy silently produce invalid results when the operation involves indices equal or greater than 2^32

Changes

src/node_buffer.cc                      | 24 ++++++++++++------
 test/parallel/test-buffer-copy-large.js | 44 +++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 8 deletions(-)

Testing

Please review the changes carefully. The fix was verified against the existing test suite.


This PR was created with the assistance of Claude Sonnet 4.6 by Anthropic | effort: high. Happy to make any adjustments!

@nodejs-github-bot nodejs-github-bot added buffer Issues and PRs related to the buffer subsystem. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Feb 21, 2026
@codecov
Copy link

codecov bot commented Feb 21, 2026

Codecov Report

❌ Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.75%. Comparing base (f632f3f) to head (9313bcf).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/node_buffer.cc 72.72% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #61914      +/-   ##
==========================================
- Coverage   91.70%   89.75%   -1.95%     
==========================================
  Files         337      674     +337     
  Lines      140104   204892   +64788     
  Branches    21758    39380   +17622     
==========================================
+ Hits       128484   183911   +55427     
- Misses      11398    13240    +1842     
- Partials      222     7741    +7519     
Files with missing lines Coverage Δ
src/node_buffer.cc 67.87% <72.72%> (ø)

... and 455 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

buffer Issues and PRs related to the buffer subsystem. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Buffer.concat and Buffer.copy silently produce invalid results when the operation involves indices equal or greater than 2^32

2 participants