Version
latest main branch
Platform
Subsystem
buffer
What steps will reproduce the bug?
const { isUtf8, isAscii } = require('node:buffer');
const view = new Uint8Array([0xff]);
structuredClone(view.buffer, { transfer: [view.buffer] });
console.log(isUtf8(view));
console.log(isAscii(view));
How often does it reproduce? Is there a required condition?
ArrayBufferViewContents reads the view's zero byte length but does not record the detached state of its backing ArrayBuffer.
What is the expected behavior? Why is that the expected behavior?
Both functions should throw ERR_INVALID_STATE, consistent with passing a detached ArrayBuffer directly.
What do you see instead?
Both functions return true.
Additional information
Version
latest main branch
Platform
Subsystem
buffer
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
ArrayBufferViewContents reads the view's zero byte length but does not record the detached state of its backing ArrayBuffer.
What is the expected behavior? Why is that the expected behavior?
Both functions should throw ERR_INVALID_STATE, consistent with passing a detached ArrayBuffer directly.
What do you see instead?
Both functions return true.
Additional information