Closed
Description
Version
v22.7.0
Platform
Darwin moe.fritz.box 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:13:18 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6030 arm64
Subsystem
Buffer
What steps will reproduce the bug?
let i = 0;
for(; i < 1_000_000; i++) {
const ashex = Buffer.from("\x80").toString("hex");
if (ashex === '80')
break;
else if(ashex !== 'c280')
console.log("Unexpected return value", ashex); //this never happened for me
}
if(i<1_000_000) {
console.log("FAILED after %d iterations",i);
process.exit(1);
} else
console.log("PASSED after %d iterations",i);
How often does it reproduce? Is there a required condition?
For me, it will consistently fail somewhere between 7000 to 1200 iterations.
What is the expected behavior? Why is that the expected behavior?
In node 20 this code does not fail , even after 1_000_000 iterations. Buffer.from("\x80").toString("hex")
always returns c280
on node 20
What do you see instead?
Buffer.from("\x80").toString("hex")
incorrectly returns 80
after sufficient iterations
Additional information
No response