-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
buffer.write incorrectly written one more byte in utf16le encoding #26422
Labels
buffer
Issues and PRs related to the buffer subsystem.
Comments
Ping @addaleax (I know you recently fixed an issue with |
addaleax
added a commit
to addaleax/node
that referenced
this issue
Mar 4, 2019
Do not write one character too much before shifting the whole result to the left when using UTF16-LE, possibly overwriting already-used memory while doing so. Fixes: nodejs#26422
3 tasks
Thanks for handling it! |
BridgeAR
pushed a commit
to BridgeAR/node
that referenced
this issue
Mar 12, 2019
Do not write one character too much before shifting the whole result to the left when using UTF16-LE, possibly overwriting already-used memory while doing so. Fixes: nodejs#26422 PR-URL: nodejs#26432 Fixes: nodejs#26422 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
BridgeAR
pushed a commit
that referenced
this issue
Mar 14, 2019
Do not write one character too much before shifting the whole result to the left when using UTF16-LE, possibly overwriting already-used memory while doing so. Fixes: #26422 PR-URL: #26432 Fixes: #26422 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
BethGriggs
pushed a commit
that referenced
this issue
Apr 16, 2019
Do not write one character too much before shifting the whole result to the left when using UTF16-LE, possibly overwriting already-used memory while doing so. Fixes: #26422 PR-URL: #26432 Fixes: #26422 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version: v11.10.1, v10.12.0
Platform: Windows 10 (64-bits)
Subsystem: buffer
File Encoding: UTF8
Please consider the following 3 lines of code:
let buf = Buffer.alloc(9);
buf.write('\ud842\udfb7', 1, 'utf16le');
console.log(buf); //<Buffer 00 42 d8 b7 df df 00 00 00>
In this example, only 4 bytes should be written.
However, the last 'df' (the 5th byte) is incorrectly written when the offset is odd number (1,3,5,...)
The text was updated successfully, but these errors were encountered: