Skip to content

Fix Array index normalize helper when index is large. #457

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

dbatyai
Copy link
Member

@dbatyai dbatyai commented Jul 23, 2015

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai.u-szeged@partner.samsung.com

@dbatyai dbatyai added bug Undesired behaviour ecma builtins Related to ECMA built-in routines labels Jul 23, 2015
@dbatyai dbatyai added this to the ECMA builtins milestone Jul 23, 2015
norm_index = uint_index > length ? 0 : length - uint_index;
}
else
{
norm_index = (uint32_t) int_index;
norm_index = ecma_number_to_uint32 (index);
Copy link
Contributor

Choose a reason for hiding this comment

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

@dbatyai, 15.4.4.10.5 uses ToInteger that doesn't perform modulo 2^32 operation during conversion. Maybe, this can lead to incorrect conversion in the cases, if index is more than 2^32.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ruben-ayrapetyan, fixed and added test case.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai.u-szeged@partner.samsung.com
@dbatyai dbatyai force-pushed the array_index_normalize_helper_fix branch from 9da491d to 796ae99 Compare July 24, 2015 08:36
@ruben-ayrapetyan
Copy link
Contributor

Looks good to me

@ruben-ayrapetyan ruben-ayrapetyan assigned egavrin and galpeter and unassigned egavrin Jul 24, 2015
@galpeter
Copy link
Contributor

Looks good to me.

@ruben-ayrapetyan ruben-ayrapetyan assigned egavrin and unassigned galpeter Jul 24, 2015
@egavrin
Copy link
Contributor

egavrin commented Jul 24, 2015

Please rebase to master and I'll merge

@egavrin egavrin assigned dbatyai and unassigned egavrin Jul 24, 2015
@galpeter
Copy link
Contributor

Landed: 6567651

@galpeter galpeter closed this Jul 24, 2015
@dbatyai dbatyai deleted the array_index_normalize_helper_fix branch July 31, 2015 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Undesired behaviour ecma builtins Related to ECMA built-in routines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants