Skip to content

Conversation

@szilagyiadam
Copy link
Contributor

@szilagyiadam szilagyiadam commented Sep 13, 2019

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

int32_t count = JERRY_MIN (distance, offset);

if (target >= length || start >= length || end == 0)
if (target >= length || start >= length || end == 0 || start >= end)
Copy link
Member

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.

Copy link
Contributor Author

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!

@dbatyai
Copy link
Member

dbatyai commented Sep 13, 2019

The commit message could also be a bit more specific about what kind of check is being added.

Copy link
Member

@rerobika rerobika left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@szilagyiadam szilagyiadam changed the title Add new check to typedarray copyWithin Fix length check for typedarray copyWithin Sep 16, 2019
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
Copy link
Member

@rerobika rerobika left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@dbatyai dbatyai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dbatyai dbatyai merged commit 0eae2f6 into jerryscript-project:master Sep 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

negative-size-param in memmove (ecma-builtin-typedarray-prototype.c)

3 participants