Version
v24.18.0, v26.5.0
Platform
Linux zelenka 6.12.96+deb13-s390x #1 SMP Debian 6.12.96-1 (2026-07-20) s390x GNU/Linux
Subsystem
StringBytes
What steps will reproduce the bug?
Run these commands
node -p 'const b=Buffer.alloc(32); b.write("\u3000",0,"utf8");b.toString().charCodeAt(0);'
node -p 'Buffer.from("\u3000").toString().charCodeAt(0);'
How often does it reproduce? Is there a required condition?
Always reproduced on big-endian.
What is the expected behavior? Why is that the expected behavior?
both commands should return 12288
What do you see instead?
On big-endian architecture (e.g. s390x) the first call returns 0 and the last 12288.
Additional information
Tested with the executables provided by nodejs.org.
v22.23.1 is not affected.
Also, this gives the correct result on big-endian:
node -p 'const b=Buffer.alloc(31); b.write("\u3000",0,"utf8");b.toString().charCodeAt(0);'
So the suspected commits are the ones adding the special cases for buflen >= 32 here:
and here
Version
v24.18.0, v26.5.0
Platform
Subsystem
StringBytes
What steps will reproduce the bug?
Run these commands
How often does it reproduce? Is there a required condition?
Always reproduced on big-endian.
What is the expected behavior? Why is that the expected behavior?
both commands should return 12288
What do you see instead?
On big-endian architecture (e.g. s390x) the first call returns 0 and the last 12288.
Additional information
Tested with the executables provided by nodejs.org.
v22.23.1 is not affected.
Also, this gives the correct result on big-endian:
So the suspected commits are the ones adding the special cases for
buflen >= 32here:node/src/string_bytes.cc
Line 751 in 6813080
and here
node/src/string_bytes.cc
Line 625 in 6813080