-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
TextEncoder.encodeInto NOT work on BIG utf8 subarray ON 22.4.1 #62610
Copy link
Copy link
Open
Labels
encodingIssues and PRs related to the TextEncoder and TextDecoder APIs.Issues and PRs related to the TextEncoder and TextDecoder APIs.v20.xIssues that can be reproduced on v20.x or PRs targeting the v20.x-staging branch.Issues that can be reproduced on v20.x or PRs targeting the v20.x-staging branch.v22.xIssues that can be reproduced on v22.x or PRs targeting the v22.x-staging branch.Issues that can be reproduced on v22.x or PRs targeting the v22.x-staging branch.
Metadata
Metadata
Assignees
Labels
encodingIssues and PRs related to the TextEncoder and TextDecoder APIs.Issues and PRs related to the TextEncoder and TextDecoder APIs.v20.xIssues that can be reproduced on v20.x or PRs targeting the v20.x-staging branch.Issues that can be reproduced on v20.x or PRs targeting the v20.x-staging branch.v22.xIssues that can be reproduced on v22.x or PRs targeting the v22.x-staging branch.Issues that can be reproduced on v22.x or PRs targeting the v22.x-staging branch.
Version
Welcome to Node.js v22.4.1
Platform
Subsystem
No response
What steps will reproduce the bug?
`
const _TE = new TextEncoder();
var s = "aÿ我𝑒"
var u8a = new Uint8Array(2429682061);
var offset = 38928786 ;
_TE.encodeInto(s,u8a.subarray(offset)) // { read: 0, written: 0 } failed
_TE.encodeInto(s,u8a.subarray(offset,offset+10)) //{ read: 5, written: 10 } success
Welcome to Node.js v22.4.1.
Type ".help" for more information.
Welcome to Node.js v24.14.0.
Type ".help" for more information.
`
How often does it reproduce? Is there a required condition?
alaways in 22.4.1
What is the expected behavior? Why is that the expected behavior?
same as 24.14.0
What do you see instead?
const _TE = new TextEncoder();
var s = "aÿ我𝑒"
var u8a = new Uint8Array(2429682061);
var offset = 38928786 ;
_TE.encodeInto(s,u8a.subarray(offset)) // 【{ read: 0, written: 0 } failed】
_TE.encodeInto(s,u8a.subarray(offset,offset+10)) //{ read: 5, written: 10 } success
Additional information
No response