Skip to content

buffer: prevent abort on indexOf with lone surrogate needle - #65430

Open
RafaelGSS wants to merge 1 commit into
nodejs:mainfrom
RafaelGSS:buffer-indexof-surrogate-abort
Open

buffer: prevent abort on indexOf with lone surrogate needle#65430
RafaelGSS wants to merge 1 commit into
nodejs:mainfrom
RafaelGSS:buffer-indexof-surrogate-abort

Conversation

@RafaelGSS

Copy link
Copy Markdown
Member

Buffer.prototype.indexOf(), lastIndexOf(), and includes() could abort when their UTF-8 string argument contained an unpaired UTF-16 surrogate. Size calculation now uses replacement-character semantics, matching Buffer.from() and the subsequent encoding step.

Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com>
@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 Aug 20, 2026
@RafaelGSS
RafaelGSS marked this pull request as ready for review August 20, 2026 13:35
@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.12%. Comparing base (e7904d4) to head (923b472).
⚠️ Report is 353 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65430      +/-   ##
==========================================
- Coverage   90.14%   90.12%   -0.03%     
==========================================
  Files         746      752       +6     
  Lines      242764   252323    +9559     
  Branches    45739    47456    +1717     
==========================================
+ Hits       218848   227400    +8552     
- Misses      15426    16218     +792     
- Partials     8490     8705     +215     
Files with missing lines Coverage Δ
src/string_bytes.cc 75.57% <100.00%> (+1.84%) ⬆️

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

@RafaelGSS RafaelGSS added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Aug 20, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 20, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

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

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. 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.

3 participants