Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

TypedArray.prototype.set needs non-trivial changes #86

Closed
marjakh opened this issue Jan 31, 2022 · 3 comments
Closed

TypedArray.prototype.set needs non-trivial changes #86

marjakh opened this issue Jan 31, 2022 · 3 comments

Comments

@marjakh
Copy link

marjakh commented Jan 31, 2022

In SetTypedArrayFromArrayLike ( https://tc39.es/ecma262/#sec-settypedarrayfromarraylike ), step 15.b can resize the target buffer. Step 15.e. checks for IsDetachedBuffer(targetBuffer); this needs to turn into an "out of bounds" check.

But in addition, I think it should re-get the target buffer length and compare it to the index it's setting, since SetValueInBuffer which it calls doesn't do any checking.

To do this, we need to keep track of the target index, not only the byte index. -> These changes are non-trivial and should be part of this proposal.

@marjakh
Copy link
Author

marjakh commented Jan 31, 2022

Clarification: This is only relevant in the case of length-tracking TAs which don't go out of bounds, so the TA won't be out of bounds but we'll still need to restrict the data we're setting.

@syg
Copy link
Collaborator

syg commented Jan 31, 2022

Steps 15.b, 15.c, and 15.d all can call user code, so, seems right. Will work on this today.

@ljharb
Copy link
Member

ljharb commented Oct 24, 2023

Closed with #87. Also, the proposal has reached stage 4.

@ljharb ljharb closed this as completed Oct 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants