We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
subarray
Since %TypedArray%.prototype.subarray does not check whether the Element Size is the same or not, it can refer to buffers outside the area.
%TypedArray%.prototype.subarray
const buffer = new Uint16Array([1, 2, 3, 4]).buffer; console.log(buffer.byteLength); // => 8 class MyArray extends Uint8Array { static get [Symbol.species]() { return Uint16Array; } } const myarr = new MyArray(buffer, 0, 4); console.log(myarr.byteLength); // => 4 // leaks! const subarray = myarr.subarray(); console.log(subarray); // => Uint16Array(4) [1, 2, 3, 4] console.log(subarray.byteLength); // => 8
This behavior is both strange and unhelpful. I think it should be fixed, as it is not expected to cause any large breaking changes.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Since
%TypedArray%.prototype.subarray
does not check whether the Element Size is the same or not, it can refer to buffers outside the area.This behavior is both strange and unhelpful. I think it should be fixed, as it is not expected to cause any large breaking changes.
The text was updated successfully, but these errors were encountered: