Closed Bug 329219 Opened 19 years ago Closed 19 years ago

Box object dangles content reference

Categories

(Core :: XUL, defect)

1.8 Branch
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: neil, Assigned: neil)

References

()

Details

(Keywords: verified1.8.0.4, verified1.8.1, Whiteboard: [sg:critical?][need testcase])

Attachments

(1 file)

Steps to reproduce problem: 1. Insert a node into a document 2. Obtain its box object 3. Remove the node and all references to it 4. Attempt to get the node from the box object nsBoxObject::GetElement segfaults because mContent is stale.
Attached patch Band-aidSplinter Review
I'm assuming here that bug 329181 will clean this up properly.
Assignee: nobody → neil
Status: NEW → ASSIGNED
Attachment #213884 - Flags: superreview?(bzbarsky)
Attachment #213884 - Flags: review?(bzbarsky)
Hmm... we remove the box object from the box object table when a node is removed from the DOM, right? And never put it back? Is that true? If so, this is probably the right fix period.
Sigh; nsIDOMNSDocument::SetBoxObjectFor is scriptable, which would seem to suggest that content can associate fake box objects with its nodes to confuse extensions... there are only three callers a) GetBoxObjectFor, to store a new box object and b) nsGenericElement/nsXULElement::UnbindFromTree, to forget the box object. But I guess that ought to be handled in a separate bug...
Why do we let web content get a box object, isn't that an internal representation?
(In reply to comment #4) >Why do we let web content get a box object, isn't that an internal representation? No, it's what's supposed to exist to protect the internal representation. (This was the third rewrite, so I gave up and heavily summarised).
> Sigh; nsIDOMNSDocument::SetBoxObjectFor is scriptable Bug 326931. I just cced you. I outline a fix in that bug...
By "mContent is stale" I assume you mean it's a deleted object, and that we therefore want this fix on old branches too?
Flags: blocking1.8.0.3?
Flags: blocking1.7.14?
Flags: blocking-aviary1.0.9?
Whiteboard: [sg:critical?]
(In reply to comment #7) >By "mContent is stale" I assume you mean it's a deleted object Yes. >and that we therefore want this fix on old branches too? As far as I can tell, given my knowledge of security policy.
Attachment #213884 - Flags: superreview?(bzbarsky)
Attachment #213884 - Flags: superreview+
Attachment #213884 - Flags: review?(bzbarsky)
Attachment #213884 - Flags: review+
Comment on attachment 213884 [details] [diff] [review] Band-aid Fwiw, on trunk I've more or less rolled this into bug 329181. We should still fix on branch, though.
Attachment #213884 - Flags: approval-branch-1.8.1+
Fix checked in to the 1.8 branch. Targetting for 1.8 and marking fixed as per comment 9.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Keywords: fixed1.8.1
Resolution: --- → FIXED
Version: Trunk → 1.8 Branch
Comment on attachment 213884 [details] [diff] [review] Band-aid Trivial stale pointer fix.
Attachment #213884 - Flags: approval1.8.0.3?
Attachment #213884 - Flags: approval1.7.14?
Attachment #213884 - Flags: approval-aviary1.0.9?
Flags: blocking1.8.0.3?
Flags: blocking1.8.0.3+
Flags: blocking1.7.14?
Flags: blocking1.7.14+
Flags: blocking-aviary1.0.9?
Flags: blocking-aviary1.0.9+
Comment on attachment 213884 [details] [diff] [review] Band-aid approved for 1.8.0 branch, a=dveditz for drivers
Attachment #213884 - Flags: approval1.8.0.3? → approval1.8.0.3+
Fix checked in to the 1.8.0 branch.
Keywords: fixed1.8.0.3
Adding [need testcase], can anyone provide a simplified testcase for this bug so we can verify the fix? If this one-liner is something that can't easily be tested, I think the comments in this bug are enough to marked this v.fixed. Let us know or just replace "fixed1.8.0.3" with "verified1.8.0.3". Thanks!
Whiteboard: [sg:critical?] → [sg:critical?][need testcase]
This bookmarklet alerts true on builds with the bug and false on fixed builds.
Reproducing reliably is hard -- it depends on JS GC timing...
I wasn't trying to reproduce the crash, just verify the fix.
verifying per reporters comment 15
Status: RESOLVED → VERIFIED
Group: security
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.xul → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: