-
Notifications
You must be signed in to change notification settings - Fork 687
Fix length check for typedarray copyWithin #3108
New issue
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
Conversation
e86ae12 to
b30fea7
Compare
| int32_t count = JERRY_MIN (distance, offset); | ||
|
|
||
| if (target >= length || start >= length || end == 0) | ||
| if (target >= length || start >= length || end == 0 || start >= end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the start >= length condition just be replaced with start >= end? It seems to me that end is always <= length.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats a good point, i will fix it!
|
The commit message could also be a bit more specific about what kind of check is being added. |
b30fea7 to
f65961a
Compare
rerobika
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
We should check if the start index is equal or greater than the end index, if thats the case, we should return with the original typedArray. Fixes jerryscript-project#3107 JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
f65961a to
877b5fb
Compare
rerobika
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
dbatyai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
We should check if the start index is equal or greater than the end index,
if thats the case, we should return with the original typedArray.
Fixes #3107
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu