Skip to content

Commit

Permalink
Disallow -0 in algorithm for checking array index (whatwg#517)
Browse files Browse the repository at this point in the history
Fixes: whatwg#516
  • Loading branch information
TimothyGu authored and tobie committed Feb 9, 2018
1 parent ebe5a88 commit 3750d7a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMA-262
text: IsConstructor; url: sec-isconstructor
text: IsDataDescriptor; url: sec-isdatadescriptor
text: IsDetachedBuffer; url: sec-isdetachedbuffer
text: IsInteger; url: sec-isinteger
text: IsSharedArrayBuffer; url: sec-issharedarraybuffer
text: IteratorStep; url: sec-iteratorstep
text: IteratorValue; url: sec-iteratorvalue
Expand Down Expand Up @@ -12620,11 +12621,13 @@ internal method as follows.
1. If <a abstract-op>Type</a>(|P|) is not String, then return <emu-val>false</emu-val>.
1. Let |index| be [=!=] <a abstract-op>CanonicalNumericIndexString</a>(|P|).
1. If |index| is <emu-val>undefined</emu-val>, then return <emu-val>false</emu-val>.
1. If |index| is less than 0 or is greater than or equal to 2<sup>32</sup> − 1, then return
<emu-val>false</emu-val>.

Note: 2<sup>32</sup> − 1 is the maximum array length allowed by ECMAScript.
1. If <a abstract-op>IsInteger</a>(|index|) is <emu-val>false</emu-val>,
then return <emu-val>false</emu-val>.
1. If |index| is −0, then return <emu-val>false</emu-val>.
1. If |index| &lt; 0, then return <emu-val>false</emu-val>.
1. If |index| ≥ 2<sup>32</sup> − 1, then return <emu-val>false</emu-val>.

Note: 2<sup>32</sup> − 1 is the maximum array length allowed by ECMAScript.
1. Return <emu-val>true</emu-val>.

</div>
Expand Down

0 comments on commit 3750d7a

Please sign in to comment.