buffer: fix odd UTF-16LE indexOf start - #65960
Open
inoway46 wants to merge 1 commit into
Open
Conversation
inoway46
marked this pull request as ready for review
September 10, 2026 12:13
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65960 +/- ##
=======================================
Coverage 90.17% 90.18%
=======================================
Files 771 771
Lines 265489 265493 +4
Branches 50471 50471
=======================================
+ Hits 239405 239425 +20
+ Misses 17042 17007 -35
- Partials 9042 9061 +19
🚀 New features to boost your workflow:
|
UTF-16LE string searches rounded odd forward start offsets down, allowing a match before the requested range. Round the start up to the next code-unit boundary while leaving reverse search and the existing 16-bit implementation unchanged. Assisted-by: Codex Signed-off-by: inoway46 <inoueyuya416@gmail.com>
inoway46
force-pushed
the
fix-utf16le-indexof-start-offset
branch
from
September 10, 2026 14:28
128a78b to
045fc67
Compare
ronag
approved these changes
Sep 10, 2026
This was referenced Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An odd forward UTF-16LE/UCS2 search start was rounded down, allowing a match before the requested start.
Round it up to the next UTF-16 code-unit boundary instead.
This preserves the existing code-unit-aligned string search semantics. It does not introduce every-byte-offset or cross-code-unit matches, or change Buffer/Uint8Array needle behavior.
Unaligned receivers are tracked separately in #65959.
Fixes: #26448