-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Adding explicit number conversion to %TypedArray%.prototype.sort #1000
Conversation
Can you merge this into a single step:
for consistency with the SortCompare algorithm in 22.1.3.25.1? Thanks! |
spec.html
Outdated
@@ -33221,7 +33221,7 @@ | |||
<emu-alg> | |||
1. Assert: Both Type(_x_) and Type(_y_) is Number. | |||
1. If _comparefn_ is not *undefined*, then | |||
1. Let _v_ be ? Call(_comparefn_, *undefined*, « _x_, _y_ »). | |||
1. Let _v_ be ToNumber(? Call(_comparefn_, *undefined*, « _x_, _y_ »)). |
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.
the ToNumber
needs a ?
prefix as well, since it can throw
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.
Done
Does this need consensus? |
shouldn't need consensus. It's pretty clearly a bug that Array sort has a ToNumber but TypedArray sort does not. |
Yep, seems like a bug to me (and a bad one, at that). Thanks! |
@natashenka Congratulations on your first commit to ECMA262! 👌👍 |
Clarifying that conversion to a number from comparefn should occur before the detachment check. This ambiguity led to this security problem: https://bugs.chromium.org/p/project-zero/issues/detail?id=983