Skip to content

buffer: handle detached ArrayBuffer views#64504

Open
Archkon wants to merge 1 commit into
nodejs:mainfrom
Archkon:viewbuffer
Open

buffer: handle detached ArrayBuffer views#64504
Archkon wants to merge 1 commit into
nodejs:mainfrom
Archkon:viewbuffer

Conversation

@Archkon

@Archkon Archkon commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Fixes: #64503

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Jul 14, 2026
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.25%. Comparing base (3ac95f2) to head (0cc6bf7).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64504      +/-   ##
==========================================
+ Coverage   90.23%   90.25%   +0.01%     
==========================================
  Files         741      741              
  Lines      241692   241695       +3     
  Branches    45541    45550       +9     
==========================================
+ Hits       218097   218140      +43     
+ Misses      15113    15101      -12     
+ Partials     8482     8454      -28     
Files with missing lines Coverage Δ
src/util-inl.h 83.38% <100.00%> (+0.74%) ⬆️

... and 29 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.

@jasnell jasnell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in the thread, I'd actually rather we went the other direction to treat detached just as zero-length with these.

@Archkon

Archkon commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

As mentioned in the thread, I'd actually rather we went the other direction to treat detached just as zero-length with these.

@jasnell
Done, Could review the code again when available? Thanks !

Treat detached ArrayBuffers and Buffer or TypedArray views backed by
them as zero-length inputs in buffer.isUtf8() and buffer.isAscii(). Both
functions now return true for these inputs, consistent with other empty
inputs.

Signed-off-by: Archkon <180910180+Archkon@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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: isUtf8 and isAscii accept detached TypedArray views

3 participants