Closed Bug 394815 Opened 18 years ago Closed 18 years ago

Still possible to create __proto__ cycles with XOW

Categories

(Core :: XPConnect, defect)

x86
macOS
defect
Not set
critical

Tracking

()

RESOLVED FIXED

People

(Reporter: jruderman, Assigned: mrbkap)

References

Details

(Keywords: crash, regression, testcase)

Attachments

(2 files)

This crashes Firefox due to too much recursion: <script> var z = {}; window.__proto__ = z; z.__proto__ = window; for (var i in window) { } </script> The third line of the script should throw a "cyclic __proto__ value" error.
Brendan, I don't see any way to fix this without some sort of help from the JS engine. Furthermore, I don't see a way of fixing this that doesn't involve exposing the wrappers (through some sort of hook) to the engine.
Let's forbid setting __proto__ to anything but null, at least for XOWs. Good? /be
Attached patch Proposed fixSplinter Review
Assignee: nobody → mrbkap
Status: NEW → ASSIGNED
Attachment #281027 - Flags: superreview?(brendan)
Attachment #281027 - Flags: review?(brendan)
Flags: blocking1.9?
Comment on attachment 281027 [details] [diff] [review] Proposed fix Would it be better to do this before the wrappedObj's proto is changed, and fail for non-null newProto values? I.e. make XOWs stricter by not letting the wrapped object have a different (non-null) proto from the one set for the wrapper? r+sr=me in case this does not make sense. /be
Attachment #281027 - Flags: superreview?(brendan)
Attachment #281027 - Flags: superreview+
Attachment #281027 - Flags: review?(brendan)
Attachment #281027 - Flags: review+
I wanted to do that, but I don't know ahead of time if the wrapped object's prototype is Object.prototype, so setting xow.__proto__ could simply be setting a property named __proto__ (if e.g., the proto chain had been severed earlier).
Attachment #281027 - Flags: approval1.9?
Attachment #281027 - Flags: approval1.9? → approval1.9+
Flags: blocking1.9? → blocking1.9+
Fixed on trunk.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Flags: in-testsuite?
(In reply to comment #2) > Let's forbid setting __proto__ to anything but null, at least for XOWs. Good? > does __proto__ have legitimate usage? it is not standard afaict.
__proto__ is moderately well-supported by the non-IE browsers, I believe; I don't have access to any at the moment to check for certain.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: