buffer: fix unaligned UTF-16LE decoding · nodejs/node@fa91224 · GitHub
Skip to content

Commit fa91224

Browse files
mcollinaaduh95
authored andcommitted
buffer: fix unaligned UTF-16LE decoding
For odd-length input, the destination only has room for complete code units. Copy those units and ignore the trailing byte. This matches the aligned and big-endian paths. Assisted-by: pi Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: #65905 Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com>
1 parent 60a9a28 commit fa91224

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎src/string_bytes.cc‎

Lines changed: 2 additions & 2 deletions

‎test/parallel/test-buffer-tostring.js‎

Lines changed: 7 additions & 0 deletions

0 commit comments

Comments
 (0)