Closed Bug 2059990 Opened 4 months ago Closed 24 days ago

[wpt-sync] Sync PR 61678 - IndexedDB: assert a self-referential array key path exhausts the stack

Categories

(Core :: Storage: IndexedDB, task, P4)

task

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Attachments

(1 file)

Sync web-platform-tests PR 61678 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/61678
Details from upstream follow.

Yusuke Suzuki <ysuzuki@apple.com> wrote:

IndexedDB: assert a self-referential array key path exhausts the stack

The "array loop -> stringify becomes ['']" case built a self-referential array and used it as an object store key path:

 let loop_array = [];
 loop_array.push(loop_array);

A sequence key path is converted with the WebIDL sequence<DOMString> conversion, so each item goes through ToString. For item 0 that is ToString(loop_array), which is Array.prototype.toString -> Array.prototype.join, and join converts element 0 with ToString again.

ECMA-262 defines no cycle detection for Array.prototype.join (https://tc39.es/ecma262/#sec-array.prototype.join), so that recursion is unbounded and the conversion cannot complete. The case asserted that the key path becomes [''] and each value is used as its own key, which only happens in an engine that non-normatively remembers the receivers it is already converting and substitutes the empty string on a repeat visit.

Assert the outcome the specification implies instead: the conversion exceeds an implementation limit and reports an error rather than quietly producing ['']. Every engine signals stack exhaustion with a RangeError.

Component: web-platform-tests → Storage: IndexedDB
Product: Testing → Core
Attached file Notable wpt changes —

CI Results

Ran 9 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 820 tests and 1 subtests

Status Summary

Firefox

OK : 4[GitHub] 629[Gecko-windows11-32-25h2-debug] 643[Gecko-windows11-64-25h2-debug] 817[Gecko-windows11-32-25h2-opt] 818[Gecko-android-em-14-x86_64-debug-geckoview] 819[Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-opt]
PASS: 76[GitHub] 3888[Gecko-windows11-64-25h2-debug] 3894[Gecko-windows11-32-25h2-debug] 5825[Gecko-android-em-14-x86_64-debug-geckoview] 5830[Gecko-windows11-32-25h2-opt] 5832[Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview] 5835[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-opt]
FAIL: 4[GitHub] 17[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt] 20[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview]

Chrome

OK : 4
PASS: 76
FAIL: 4

Safari

OK : 4
PASS: 76
FAIL: 4

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

(See attachment for full changes)

Status: NEW → RESOLVED
Closed: 24 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: