Closed
Bug 868265
Opened 12 years ago
Closed 12 years ago
MozNamedAttrMap.removeNamedItem crash
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla23
Tracking | Status | |
---|---|---|
firefox21 | --- | unaffected |
firefox22 | --- | unaffected |
firefox23 | + | fixed |
firefox-esr17 | --- | unaffected |
b2g18 | --- | unaffected |
People
(Reporter: jruderman, Assigned: smaug)
References
Details
(5 keywords, Whiteboard: [adv-main23-])
Attachments
(3 files)
219 bytes,
text/html
|
Details | |
9.25 KB,
patch
|
mccr8
:
review+
|
Details | Diff | Splinter Review |
9.74 KB,
patch
|
Details | Diff | Splinter Review |
1. Install https://www.squarefree.com/extensions/domFuzzLite3.xpi
2. Load the testcase
Without a GC, removeNamedItem throws. With a GC, it tries to return null, but crashes because the WebIDL (added in bug 852135) says it can't return null.
The crash is probably a regression from bug 852135, but did the underlying problem exist before then?
Why does the behavior depend on GC? Is there a GC hazard lurking here?
Comment 1•12 years ago
|
||
The problem is that the attributes object holds a weak reference to its element, and after the element goes away, removeNamedItem tries to return null. I think it might be better to make attributes hold a strong reference instead.
Assignee | ||
Updated•12 years ago
|
Assignee: nobody → bugs
Assignee | ||
Comment 2•12 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=a4fd9911b8a7
Fixed also QI to nsISupports.
nsIAttribute ctor isn't inline anymore so that there isn't need
to #include nsDOMAttributeMap.
Made nsDOMAttributeMap::RemoveNamedItem to throw similarly as the
*NS version of the method. That would have fixed this bug too, but better
to make things in such way the GC/CCing isn't detectable from web pages.
Added skippability since I've seen AttributeMaps in logs.
BBP could be improved, but added the easy cases.
Crossing fingers that try results are ok :)
Attachment #746046 -
Flags: review?(continuation)
Assignee | ||
Comment 3•12 years ago
|
||
Comment 4•12 years ago
|
||
Comment on attachment 746046 [details] [diff] [review]
strong ownership, add some skippability and black-bit-propagation
Review of attachment 746046 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/base/src/Attr.cpp
@@ +91,5 @@
> + }
> +NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
> +
> +NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(Attr)
> + return tmp->IsBlackAndDoesNotNeedTracing(static_cast<nsIAttribute*>(tmp));
same question as for nsDOMAttributeMap.cpp
::: content/base/src/nsDOMAttributeMap.cpp
@@ +101,5 @@
> + }
> +NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
> +
> +NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsDOMAttributeMap)
> + return tmp->IsBlackAndDoesNotNeedTracing(tmp);
Why can't you use IsBlack() here? The wrapper cache is the only thing we trace. Should we be tracing additional things? Or is this to handle the case when our wrapper is unpreserved? Why do you have to use IsBlack in CanSkipThis?
Attachment #746046 -
Flags: review?(continuation) → review+
Assignee | ||
Comment 5•12 years ago
|
||
I don't have to use IsBlackAndDoesNotNeedTracing(), but it is there for future proof.
IsBlack() is faster in CanSkipThis: https://bugzilla.mozilla.org/show_bug.cgi?id=794694#c4
Comment 6•12 years ago
|
||
Ahh makes sense. Yes, I managed to totally forget about 794694 somehow. That was clever of me to think of that. ;)
If you could give this a security rating that would be helpful. I don't understand the security consequences of the existing code. Also is it just a regression from bug 852135 or probably an existing problem? Basically, everything Jesse asked in comment 0.
Assignee | ||
Comment 7•12 years ago
|
||
This is just a regression from bug 852135, but the patch ends up fixing other stuff too.
I'm not sure about rating. Returning null when bindings expect non-null. I think those have been
sg-crit usually.
Updated•12 years ago
|
status-b2g18:
--- → unaffected
status-firefox21:
--- → unaffected
status-firefox22:
--- → unaffected
status-firefox23:
--- → affected
status-firefox-esr17:
--- → unaffected
tracking-firefox23:
--- → ?
Keywords: sec-critical
Updated•12 years ago
|
Assignee | ||
Comment 8•12 years ago
|
||
Comment 9•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
Updated•11 years ago
|
Whiteboard: [adv-main23-]
Updated•11 years ago
|
Group: core-security
You need to log in
before you can comment on or make changes to this bug.
Description
•