Skip to content

fix handling of buffer slices#2541

Merged
anonrig merged 1 commit intomainfrom
yagiz/fix-buffer-slice
Aug 16, 2024
Merged

fix handling of buffer slices#2541
anonrig merged 1 commit intomainfrom
yagiz/fix-buffer-slice

Conversation

@anonrig
Copy link
Copy Markdown
Contributor

@anonrig anonrig commented Aug 16, 2024

Our implementation was wrong by assuming the second parameter of utf8Slice() was the length. The correct implementation was: utf8Slice(start, end) where start and end represents the index.

This makes the implementation correct and in par with Node.js' implementations.

Fixes #2538

@anonrig anonrig requested a review from jasnell August 16, 2024 14:43
@anonrig anonrig requested review from a team as code owners August 16, 2024 14:43
@anonrig anonrig requested review from a team and dom96 August 16, 2024 14:43
@anonrig anonrig force-pushed the yagiz/fix-buffer-slice branch from 1c2010f to c34d895 Compare August 16, 2024 14:44
@anonrig anonrig requested a review from npaun August 16, 2024 14:46
@anonrig anonrig merged commit a61bb30 into main Aug 16, 2024
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.

Buffer.prototype.asciiSlice, etc use offset, length instead of start, end

3 participants