Closed
Bug 394042
Opened 18 years ago
Closed 18 years ago
Dangling pointer in nsXULPDGlobalObject leads to mem corruption/crashes
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: bent.mozilla, Assigned: bent.mozilla)
References
Details
Attachments
(2 files, 3 obsolete files)
|
995 bytes,
patch
|
jst
:
review+
jst
:
superreview+
jst
:
approval1.9+
|
Details | Diff | Splinter Review |
|
2.45 KB,
patch
|
bent.mozilla
:
review+
bent.mozilla
:
superreview+
jst
:
approval1.9+
|
Details | Diff | Splinter Review |
nsXULPDGlobalObject::ClearGlobalObjectOwner doesn't null out mGlobalObjectOwner and leads to this (I think), which is the #9 topcrash on windows at the moment:
bp-7a8bc2d4-5516-11dc-a69b-001a4bd43e5c
Looks like trouble from bug 389911.
bz and Purify helped me find this.
| Assignee | ||
Comment 1•18 years ago
|
||
Fix?
| Assignee | ||
Updated•18 years ago
|
Flags: blocking1.9?
Comment 2•18 years ago
|
||
Comment on attachment 278610 [details] [diff] [review]
Null it out!
Hmm, interesting. Looks like the right thing to do no doubt, but bug 389911 didn't really change this AFAICT from looking at the patch, SetGlobalObjectOwner(), which was replaced by ClearGlobalObjectOwner(), didn't null out mGlobalObjectOwner either.
Either way, r+sr+a=jst
Attachment #278610 -
Flags: superreview+
Attachment #278610 -
Flags: review?(jst)
Attachment #278610 -
Flags: review+
Attachment #278610 -
Flags: approval1.9+
| Assignee | ||
Comment 3•18 years ago
|
||
Fixed. Thanks!
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
| Assignee | ||
Updated•18 years ago
|
Flags: blocking1.9?
Comment 4•18 years ago
|
||
Hmm. Before that patch landed we had nsXULPrototypeDocument::~nsXULPrototypeDocument doing:
- mGlobalObject->SetGlobalObjectOwner(nsnull);
and nsXULPDGlobalObject::SetGlobalObjectOwner indeed never set mGlobalObjectOwner. I'm not sure just clearing the owner is right; the right fix imo would be to cache the owner's current principal so GetPrincipal() doesn't suddenly start returning null and _then_ clear the owner. Otherwise we're silently changing the security context of this global, which is almost worse than crashing...
Comment 5•18 years ago
|
||
I _would_ like to know why this broke, by the way, since bug 389911 doesn't seem to obviously be it.
| Assignee | ||
Comment 6•18 years ago
|
||
Reopening based on comment 4.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
| Assignee | ||
Comment 7•18 years ago
|
||
Attachment #278713 -
Flags: review?(bzbarsky)
Comment 8•18 years ago
|
||
Comment on attachment 278713 [details] [diff] [review]
Cache the principal
No. You don't want to save the cached principal until the script global object owner is going away. Up until that point you want to use that owner's principal, no matter what.
Note also that if |this == nsXULPrototypeDocument::gSystemGlobal| you should never need to do anything with the cached principal.
Attachment #278713 -
Flags: review?(bzbarsky) → review-
| Assignee | ||
Comment 9•18 years ago
|
||
Like this?
Attachment #278713 -
Attachment is obsolete: true
Attachment #278720 -
Flags: review?(bzbarsky)
| Assignee | ||
Comment 10•18 years ago
|
||
Actually, you probably meant like this.
Attachment #278720 -
Attachment is obsolete: true
Attachment #278723 -
Flags: review?(bzbarsky)
Attachment #278720 -
Flags: review?(bzbarsky)
Comment 11•18 years ago
|
||
Comment on attachment 278723 [details] [diff] [review]
Cache the principal, v3
>Index: content/xul/document/src/nsXULPrototypeDocument.cpp
>+ if (mCachedPrincipal) {
>+ return mCachedPrincipal;
>+ }
> return nsnull;
That's equivalent to:
return mCachedPrincipal;
With that change, r+sr=bzbarsky
Attachment #278723 -
Flags: superreview+
Attachment #278723 -
Flags: review?(bzbarsky)
Attachment #278723 -
Flags: review+
| Assignee | ||
Comment 12•18 years ago
|
||
Same patch with that change.
Attachment #278723 -
Attachment is obsolete: true
Attachment #278727 -
Flags: superreview+
Attachment #278727 -
Flags: review+
Attachment #278727 -
Flags: approval1.9?
Updated•18 years ago
|
Attachment #278727 -
Flags: approval1.9? → approval1.9+
| Assignee | ||
Comment 13•18 years ago
|
||
Cool, all fixed up.
Status: REOPENED → RESOLVED
Closed: 18 years ago → 18 years ago
Resolution: --- → FIXED
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•