Heap-use-after-free in nsEventTargetChainItem::SetNewTarget
Originally disclosed on Mozilla
- Fixed in 12 hours
- Paid in 5 months
- Disclosed after 12 hours
Created attachment 792201 test.html
<subprocess.Popen object at 0x28ecb90>
==22461==ERROR: AddressSanitizer: heap-use-after-free on address 0x622000568920 at pc 0x7f1da5ec2763 bp 0x7fff38cc6090 sp 0x7fff38cc6088 READ of size 8 at 0x622000568920 thread T0 #0 0x7f1da5ec2762 in nsCOMPtr_base::assign_assuming_AddRef(nsISupports*) media/webrtc/signaling/signaling_ecc/../../../../dist/include/nsCOMPtr.h:457 #1 0x7f1db736821e in nsCOMPtr_base::assign_with_AddRef(nsISupports*) xpcom/build/nsCOMPtr.cpp:49 #2 0x7f1da5ed79e0 in nsCOMPtrmozilla::dom::EventTarget::operator=(mozilla::dom::EventTarget*) embedding/browser/webBrowser/../../../dist/include/nsCOMPtr.h:656 #3 0x7f1dab2f89ae in nsEventTargetChainItem::SetNewTarget(mozilla::dom::EventTarget*) content/events/src/nsEventDispatcher.cpp:91 #4 0x7f1dab2ee1a6 in nsEventDispatcher::Dispatch(nsISupports*, nsPresContext*, nsEvent*, nsIDOMEvent*, nsEventStatus*, nsDispatchingCallback*, nsCOMArraymozilla::dom::EventTarget) content/events/src/nsEventDispatcher.cpp:554 #5 0x7f1dacbb9312 in nsGlobalWindow::PostHandleEvent(nsEventChainPostVisitor&) dom/base/nsGlobalWindow.cpp:3077 #6 0x7f1dab2e692f in nsEventTargetChainItem::PostHandleEvent(nsEventChainPostVisitor&, nsCxPusher) content/events/src/nsEventDispatcher.cpp:236 #7 0x7f1dab2e8445 in nsEventTargetChainItem::HandleEventTargetChain(nsTArray<nsEventTargetChainItem>&, nsEventChainPostVisitor&, nsDispatchingCallback*, ELMCreationDetector&, nsCxPusher*) content/events/src/nsEventDispatcher.cpp:285 #8 0x7f1dab2e9adc in nsEventTargetChainItem::HandleEventTargetChain(nsTArray<nsEventTargetChainItem>&, nsEventChainPostVisitor&, nsDispatchingCallback*, ELMCreationDetector&, nsCxPusher*) content/events/src/nsEventDispatcher.cpp:332 #9 0x7f1dab2ee826 in nsEventDispatcher::Dispatch(nsISupports*, nsPresContext*, nsEvent*, nsIDOMEvent*, nsEventStatus*, nsDispatchingCallback*, nsCOMArraymozilla::dom::EventTarget) content/events/src/nsEventDispatcher.cpp:576 #10 0x7f1da85d5ecc in nsDocumentViewer::LoadComplete(tag_nsresult) layout/base/nsDocumentViewer.cpp:1036 #11 0x7f1dafec0129 in nsDocShell::EndPageLoad(nsIWebProgress, nsIChannel*, tag_nsresult) docshell/base/nsDocShell.cpp:6694 #12 0x7f1dafeb7d7b in nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, tag_nsresult) docshell/base/nsDocShell.cpp:6491 #13 0x7f1dafeb8cc8 in non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, tag_nsresult) docshell/base/nsDocShell.cpp:6497 #14 0x7f1daff9cde3 in nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, tag_nsresult) uriloader/base/nsDocLoader.cpp:1331 #15 0x7f1daff9ad1b in nsDocLoader::doStopDocumentLoad(nsIRequest*, tag_nsresult) uriloader/base/nsDocLoader.cpp:865 #16 0x7f1daff94cd3 in nsDocLoader::DocLoaderIsEmpty(bool) uriloader/base/nsDocLoader.cpp:755 #17 0x7f1daff98e2b in nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) uriloader/base/nsDocLoader.cpp:639 #18 0x7f1daff9a439 in non-virtual thunk to nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) uriloader/base/nsDocLoader.cpp:642 #19 0x7f1da653fe6d in nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, tag_nsresult) netwerk/base/src/nsLoadGroup.cpp:687 #20 0x7f1daa4273a1 in nsDocument::DoUnblockOnload() content/base/src/nsDocument.cpp:7990 #21 0x7f1daa426dea in nsDocument::UnblockOnload(bool) content/base/src/nsDocument.cpp:7918 #22 0x7f1daa3db509 in nsDocument::DispatchContentLoadedEvents() content/base/src/nsDocument.cpp:4704 #23 0x7f1daa4f5d5b in nsRunnableMethodImpl<void (nsDocument::)(), true>::Run() content/base/src/../../../dist/include/nsThreadUtils.h:356 #24 0x7f1db777c22c in nsThread::ProcessNextEvent(bool, bool) xpcom/threads/nsThread.cpp:622 #25 0x7f1db73b8273 in NS_ProcessNextEvent(nsIThread*, bool) xpcom/build/nsThreadUtils.cpp:238 #26 0x7f1db2437a68 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) ipc/glue/MessagePump.cpp:81 #27 0x7f1db7ccf027 in MessageLoop::RunInternal() ipc/chromium/src/base/message_loop.cc:220 #28 0x7f1db7ccec7a in MessageLoop::RunHandler() ipc/chromium/src/base/message_loop.cc:213 #29 0x7f1db7cceb55 in MessageLoop::Run() ipc/chromium/src/base/message_loop.cc:187 #30 0x7f1db1b7732f in nsBaseAppShell::Run() widget/xpwidgets/nsBaseAppShell.cpp:161 #31 0x7f1db04f633f in nsAppStartup::Run() toolkit/components/startup/nsAppStartup.cpp:269 #32 0x7f1da579fb11 in XREMain::XRE_mainRun() toolkit/xre/nsAppRunner.cpp:3855 #33 0x7f1da57a298a in XREMain::XRE_main(int, char**, nsXREAppData const*) toolkit/xre/nsAppRunner.cpp:3923 #34 0x7f1da57a4e14 in XRE_main toolkit/xre/nsAppRunner.cpp:4125 #35 0x457257 in do_main(int, char**, nsIFile*) browser/app/nsBrowserApp.cpp:275 #36 0x454385 in main browser/app/nsBrowserApp.cpp:635 #37 0x7f1dcd31e76c in #38 0x453adc in _start 0x622000568920 is located 32 bytes inside of 5128-byte region [0x622000568900,0x622000569d08) freed by thread T0 here: #0 0x440d0b in realloc asan_rtl #1 0x7f1dce6d65f8 in moz_xrealloc memory/mozalloc/mozalloc.cpp:86 #2 0x7f1da5d654d7 in nsTArrayInfallibleAllocator::Realloc(void*, unsigned long) media/webrtc/signaling/signaling_ecc/../../../../dist/include/nsTArray.h:205 #3 0x7f1dab2fabb5 in nsTArray_base<nsTArrayInfallibleAllocator, nsTArray_CopyElements<nsEventTargetChainItem> >::EnsureCapacity(unsigned int, unsigned int) content/events/src/../../../dist/include/nsTArray-inl.h:170 #4 0x7f1dab300a8a in nsTArray_Impl<nsEventTargetChainItem, nsTArrayInfallibleAllocator>::AppendElements(unsigned int) content/events/src/../../../dist/include/nsTArray.h:1224 #5 0x7f1dab30079f in nsTArray_Impl<nsEventTargetChainItem, nsTArrayInfallibleAllocator>::AppendElement() content/events/src/../../../dist/include/nsTArray.h:1239 #6 0x7f1dab2f7ba1 in nsEventTargetChainItem::Create(nsTArray<nsEventTargetChainItem>&, mozilla::dom::EventTarget*, nsEventTargetChainItem*) content/events/src/nsEventDispatcher.cpp:67 #7 0x7f1dab2eda66 in nsEventDispatcher::Dispatch(nsISupports*, nsPresContext*, nsEvent*, nsIDOMEvent*, nsEventStatus*, nsDispatchingCallback*, nsCOMArraymozilla::dom::EventTarget) content/events/src/nsEventDispatcher.cpp:522 #8 0x7f1dacbb9312 in nsGlobalWindow::PostHandleEvent(nsEventChainPostVisitor&) dom/base/nsGlobalWindow.cpp:3077 #9 0x7f1dab2e692f in nsEventTargetChainItem::PostHandleEvent(nsEventChainPostVisitor&, nsCxPusher) content/events/src/nsEventDispatcher.cpp:236 #10 0x7f1dab2e8445 in nsEventTargetChainItem::HandleEventTargetChain(nsTArray<nsEventTargetChainItem>&, nsEventChainPostVisitor&, nsDispatchingCallback*, ELMCreationDetector&, nsCxPusher*) content/events/src/nsEventDispatcher.cpp:285 #11 0x7f1dab2e9adc in nsEventTargetChainItem::HandleEventTargetChain(nsTArray<nsEventTargetChainItem>&, nsEventChainPostVisitor&, nsDispatchingCallback*, ELMCreationDetector&, nsCxPusher*) content/events/src/nsEventDispatcher.cpp:332 #12 0x7f1dab2ee826 in nsEventDispatcher::Dispatch(nsISupports*, nsPresContext*, nsEvent*, nsIDOMEvent*, nsEventStatus*, nsDispatchingCallback*, nsCOMArraymozilla::dom::EventTarget) content/events/src/nsEventDispatcher.cpp:576 #13 0x7f1da85d5ecc in nsDocumentViewer::LoadComplete(tag_nsresult) layout/base/nsDocumentViewer.cpp:1036 #14 0x7f1dafec0129 in nsDocShell::EndPageLoad(nsIWebProgress, nsIChannel*, tag_nsresult) docshell/base/nsDocShell.cpp:6694 #15 0x7f1dafeb7d7b in nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, tag_nsresult) docshell/base/nsDocShell.cpp:6491 #16 0x7f1dafeb8cc8 in non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, tag_nsresult) docshell/base/nsDocShell.cpp:6497 #17 0x7f1daff9cde3 in nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, tag_nsresult) uriloader/base/nsDocLoader.cpp:1331 #18 0x7f1daff9ad1b in nsDocLoader::doStopDocumentLoad(nsIRequest*, tag_nsresult) uriloader/base/nsDocLoader.cpp:865 #19 0x7f1daff94cd3 in nsDocLoader::DocLoaderIsEmpty(bool) uriloader/base/nsDocLoader.cpp:755 #20 0x7f1daff98e2b in nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) uriloader/base/nsDocLoader.cpp:639 #21 0x7f1daff9a439 in non-virtual thunk to nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) uriloader/base/nsDocLoader.cpp:642 #22 0x7f1da653fe6d in nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, tag_nsresult) netwerk/base/src/nsLoadGroup.cpp:687 #23 0x7f1daa4273a1 in nsDocument::DoUnblockOnload() content/base/src/nsDocument.cpp:7990 #24 0x7f1daa426dea in nsDocument::UnblockOnload(bool) content/base/src/nsDocument.cpp:7918 #25 0x7f1daa3db509 in nsDocument::DispatchContentLoadedEvents() content/base/src/nsDocument.cpp:4704 #26 0x7f1daa4f5d5b in nsRunnableMethodImpl<void (nsDocument::)(), true>::Run() content/base/src/../../../dist/include/nsThreadUtils.h:356 #27 0x7f1db777c22c in nsThread::ProcessNextEvent(bool, bool) xpcom/threads/nsThread.cpp:622 #28 0x7f1db73b8273 in NS_ProcessNextEvent(nsIThread*, bool) xpcom/build/nsThreadUtils.cpp:238 #29 0x7f1db2437a68 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) ipc/glue/MessagePump.cpp:81 previously allocated by thread T0 here: #0 0x440b65 in malloc asan_rtl #1 0x7f1dce6d5b81 in moz_xmalloc memory/mozalloc/mozalloc.cpp:54 #2 0x7f1da5d64a6a in nsTArrayInfallibleAllocator::Malloc(unsigned long) media/webrtc/signaling/signaling_ecc/../../../../dist/include/nsTArray.h:201 #3 0x7f1dab2fa1db in nsTArray_base<nsTArrayInfallibleAllocator, nsTArray_CopyElements<nsEventTargetChainItem> >::EnsureCapacity(unsigned int, unsigned int) content/events/src/../../../dist/include/nsTArray-inl.h:119 #4 0x7f1dab2f9a40 in nsTArray_Impl<nsEventTargetChainItem, nsTArrayInfallibleAllocator>::SetCapacity(unsigned int) content/events/src/../../../dist/include/nsTArray.h:1344 #5 0x7f1dab2f96de in nsTArray_Impl<nsEventTargetChainItem, nsTArrayInfallibleAllocator>::nsTArray_Impl(unsigned int) content/events/src/../../../dist/include/nsTArray.h:758 #6 0x7f1dab2f94e3 in nsTArray<nsEventTargetChainItem>::nsTArray(unsigned int) content/events/src/../../../dist/include/nsTArray.h:1630 #7 0x7f1dab2f81d0 in nsTArray<nsEventTargetChainItem>::nsTArray(unsigned int) content/events/src/../../../dist/include/nsTArray.h:1630 #8 0x7f1dab2ec607 in nsEventDispatcher::Dispatch(nsISupports*, nsPresContext*, nsEvent*, nsIDOMEvent*, nsEventStatus*, nsDispatchingCallback*, nsCOMArraymozilla::dom::EventTarget) content/events/src/nsEventDispatcher.cpp:459 #9 0x7f1dacbb9312 in nsGlobalWindow::PostHandleEvent(nsEventChainPostVisitor&) dom/base/nsGlobalWindow.cpp:3077 #10 0x7f1dab2e692f in nsEventTargetChainItem::PostHandleEvent(nsEventChainPostVisitor&, nsCxPusher) content/events/src/nsEventDispatcher.cpp:236 #11 0x7f1dab2e8445 in nsEventTargetChainItem::HandleEventTargetChain(nsTArray<nsEventTargetChainItem>&, nsEventChainPostVisitor&, nsDispatchingCallback*, ELMCreationDetector&, nsCxPusher*) content/events/src/nsEventDispatcher.cpp:285 #12 0x7f1dab2e9adc in nsEventTargetChainItem::HandleEventTargetChain(nsTArray<nsEventTargetChainItem>&, nsEventChainPostVisitor&, nsDispatchingCallback*, ELMCreationDetector&, nsCxPusher*) content/events/src/nsEventDispatcher.cpp:332 #13 0x7f1dab2ee826 in nsEventDispatcher::Dispatch(nsISupports*, nsPresContext*, nsEvent*, nsIDOMEvent*, nsEventStatus*, nsDispatchingCallback*, nsCOMArraymozilla::dom::EventTarget) content/events/src/nsEventDispatcher.cpp:576 #14 0x7f1da85d5ecc in nsDocumentViewer::LoadComplete(tag_nsresult) layout/base/nsDocumentViewer.cpp:1036 #15 0x7f1dafec0129 in nsDocShell::EndPageLoad(nsIWebProgress, nsIChannel*, tag_nsresult) docshell/base/nsDocShell.cpp:6694 #16 0x7f1dafeb7d7b in nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, tag_nsresult) docshell/base/nsDocShell.cpp:6491 #17 0x7f1dafeb8cc8 in non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, tag_nsresult) docshell/base/nsDocShell.cpp:6497 #18 0x7f1daff9cde3 in nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, tag_nsresult) uriloader/base/nsDocLoader.cpp:1331 #19 0x7f1daff9ad1b in nsDocLoader::doStopDocumentLoad(nsIRequest*, tag_nsresult) uriloader/base/nsDocLoader.cpp:865 #20 0x7f1daff94cd3 in nsDocLoader::DocLoaderIsEmpty(bool) uriloader/base/nsDocLoader.cpp:755 #21 0x7f1daff98e2b in nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) uriloader/base/nsDocLoader.cpp:639 #22 0x7f1daff9a439 in non-virtual thunk to nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) uriloader/base/nsDocLoader.cpp:642 #23 0x7f1da653fe6d in nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, tag_nsresult) netwerk/base/src/nsLoadGroup.cpp:687 #24 0x7f1daa4273a1 in nsDocument::DoUnblockOnload() content/base/src/nsDocument.cpp:7990 #25 0x7f1daa426dea in nsDocument::UnblockOnload(bool) content/base/src/nsDocument.cpp:7918 #26 0x7f1daa3db509 in nsDocument::DispatchContentLoadedEvents() content/base/src/nsDocument.cpp:4704 #27 0x7f1daa4f5d5b in nsRunnableMethodImpl<void (nsDocument::)(), true>::Run() content/base/src/../../../dist/include/nsThreadUtils.h:356 #28 0x7f1db777c22c in nsThread::ProcessNextEvent(bool, bool) xpcom/threads/nsThread.cpp:622 #29 0x7f1db73b8273 in NS_ProcessNextEvent(nsIThread*, bool) xpcom/build/nsThreadUtils.cpp:238 Shadow bytes around the buggy address: 0x0c44800a50d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c44800a50e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c44800a50f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c44800a5100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c44800a5110: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x0c44800a5120: fd fd fd fd[fd]fd fd fd fd fd fd fd fd fd fd fd 0x0c44800a5130: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c44800a5140: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c44800a5150: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c44800a5160: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c44800a5170: fd fd fd fd fd fd fd fd 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 Heap right redzone: fb Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack partial redzone: f4 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 ASan internal: fe ==22461==ABORTING
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A critical-severity memory corruption bug in DOM: Events. Mozilla made it public on 20 August 2013.
About Memory corruption
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.