Closed Bug 1461272 Opened 7 years ago Closed 7 years ago

Missing sealed-elements check in js::ArraySetLength

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox62 --- fixed

People

(Reporter: anba, Assigned: jandem)

References

Details

Attachments

(1 file)

This fast path [1] must not be taken when the elements are sealed. Test case: --- var r = [1, 2, 3, 4]; Object.seal(r); r.length = 0; print(r); --- Expected: - Prints "1,2,3,4" Actual: - Prints "" [1] https://searchfox.org/mozilla-central/rev/a85db9e29eb3f022dbaf8b9a6390ecbacf51e7dd/js/src/builtin/Array.cpp#783
Good find. This was not a problem with frozen elements because frozen implies non-writable length.
Flags: needinfo?(jdemooij)
Attached patch PatchSplinter Review
Assignee: nobody → jdemooij
Status: NEW → ASSIGNED
Flags: needinfo?(jdemooij)
Attachment #8975478 - Flags: review?(andrebargull)
Attachment #8975478 - Flags: review?(andrebargull) → review+
Pushed by jandemooij@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/10109d328995 Add missing sealed elements check to ArraySetLength fast path. r=anba
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: