"ASSERTION: should have a JS object by this point" with setUserData, GC




8 years ago
8 years ago


(Reporter: jruderman, Assigned: mrbkap)


(Blocks: 2 bugs, {assertion, testcase})

assertion, testcase
Dependency tree / graph

Firefox Tracking Flags

(blocking2.0 -)


(Whiteboard: [sg:nse] fixed-in-tracemonkey)


(3 attachments)



8 years ago
Created attachment 516190 [details]
testcase (requires extension for GC)

1. Install 'DOM Fuzz Lite' from
2. Load the testcase.

###!!! ASSERTION: should have a JS object by this point: 'win->GetOuterWindowInternal()->IsCreatingInnerWindow()', file dom/base/nsDOMClassInfo.cpp, line 5022

###!!! ASSERTION: Non-global object has the wrong flags: '!(jsclazz->flags & JSCLASS_IS_GLOBAL)', file js/src/xpconnect/src/xpcwrappednative.cpp, line 1153

Security-sensitive because I'm scared of anything that involves GC. Or inner and outer windows.

Comment 1

8 years ago
Created attachment 516191 [details]
stack traces


8 years ago
blocking2.0: --- → ?

Comment 2

8 years ago
This doesn't look exploitable. Why blocking?

Comment 3

8 years ago
b- please renom if we see any indication that this is indeed exploitable
blocking2.0: ? → -
Given that we don't know of this being exploitable or anything, marking this sg:nse, and keeping it closed for now. Blake, can you have a look?
Assignee: nobody → mrbkap
Whiteboard: [sg:nse]
Created attachment 517543 [details] [diff] [review]
Proposed fix

So, the problem here is that the variant holds a reference to the outer window proxy and a reference to the current inner window's C++ object. After the iframe navigates, we brain transplant the outer window, and the old inner window's JS object has no more references to it, so we collect it. Later, we attempt to wrap the inner window into JS and recreate its JS object (and hit the assertion). This patch fixes this by making us hold a reference to the non-brain-transplanted inner object, meaning we won't recreate the JS object. This means we'll hold the old inner window alive longer, but I'm OK with that.
Attachment #517543 - Flags: review?(jst)
Attachment #517543 - Flags: review?(jst) → review+
Whiteboard: [sg:nse] → [sg:nse] fixed-in-tracemonkey
Blake: we don't have brain transplants on the 1.9.x branches, but we do have inner and outer windows and we have seen the assertions in comment 0 (bug 637226). Do we need a variant of this fix on branches? Maybe not if it's truly unexploitable.
No. On older branches, the variant ends up holding a strong reference to the outer window, not the inner and the jsval that it holds is also for the outer, so it won't be garbage collected. Because the value and the nsISupports match there is no bug.
Group: core-security
Blocks: 637226
Last Resolved: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.