Skip to content
Memory corruption Disclosed report

Heap-use-after-free in mozilla::image::VectorImage::CancelAllListeners

Abhishek Arya Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 3 days
  • Paid in 10 days
  • Disclosed after 3 days

Created attachment 717450 Testcase

==18126== ERROR: AddressSanitizer: heap-use-after-free on address 0x6028002a14d0 at pc 0x7f8d08dd6022 bp 0x7fff595b6f30 sp 0x7fff595b6f28 READ of size 8 at 0x6028002a14d0 thread T0 #0 0x7f8d08dd6021 in nsRefPtrmozilla::image::SVGParseCompleteListener::get() const /usr/local/google/home/aarya/firefox/src/../../dist/include/nsAutoPtr.h:1009 #1 0x7f8d08dd1b49 in nsRefPtrmozilla::image::SVGParseCompleteListener::operator mozilla::image::SVGParseCompleteListener*() const /usr/local/google/home/aarya/firefox/src/../../dist/include/nsAutoPtr.h:1022 #2 0x7f8d08dd199c in mozilla::image::VectorImage::CancelAllListeners() /usr/local/google/home/aarya/firefox/src/image/src/VectorImage.cpp:905 #3 0x7f8d08dd26fd in mozilla::image::VectorImage::OnSVGDocumentLoaded() /usr/local/google/home/aarya/firefox/src/image/src/VectorImage.cpp:923 #4 0x7f8d08dd4e3f in mozilla::image::SVGLoadEventListener::HandleEvent(nsIDOMEvent*) /usr/local/google/home/aarya/firefox/src/image/src/VectorImage.cpp:191 #5 0x7f8d0bea3315 in nsEventListenerManager::HandleEventSubType(nsListenerStruct*, nsIDOMEventListener*, nsIDOMEvent*, nsIDOMEventTarget*, nsCxPusher*) /usr/local/google/home/aarya/firefox/src/content/events/src/nsEventListenerManager.cpp:923 #6 0x7f8d0bea4b27 in nsEventListenerManager::HandleEventInternal(nsPresContext*, nsEvent*, nsIDOMEvent**, nsIDOMEventTarget*, nsEventStatus*, nsCxPusher*) /usr/local/google/home/aarya/firefox/src/content/events/src/nsEventListenerManager.cpp:990 #7 0x7f8d0c09705a in nsEventListenerManager::HandleEvent(nsPresContext*, nsEvent*, nsIDOMEvent**, nsIDOMEventTarget*, nsEventStatus*, nsCxPusher*) /usr/local/google/home/aarya/firefox/src/content/events/src/nsEventListenerManager.h:278 #8 0x7f8d0c08620c in nsEventTargetChainItem::HandleEvent(nsEventChainPostVisitor&, bool, nsCxPusher*) /usr/local/google/home/aarya/firefox/src/content/events/src/nsEventDispatcher.cpp:181 #9 0x7f8d0c084473 in nsEventTargetChainItem::HandleEventTargetChain(nsEventChainPostVisitor&, nsDispatchingCallback*, bool, nsCxPusher*) /usr/local/google/home/aarya/firefox/src/content/events/src/nsEventDispatcher.cpp:310 #10 0x7f8d0c08c1a7 in nsEventDispatcher::Dispatch(nsISupports*, nsPresContext*, nsEvent*, nsIDOMEvent*, nsEventStatus*, nsDispatchingCallback*, nsCOMArray<nsIDOMEventTarget>) /usr/local/google/home/aarya/firefox/src/content/events/src/nsEventDispatcher.cpp:678 #11 0x7f8d0c08e9f9 in nsEventDispatcher::DispatchDOMEvent(nsISupports, nsEvent*, nsIDOMEvent*, nsPresContext*, nsEventStatus*) /usr/local/google/home/aarya/firefox/src/content/events/src/nsEventDispatcher.cpp:738 #12 0x7f8d0b374a85 in nsINode::DispatchEvent(nsIDOMEvent*, bool*) /usr/local/google/home/aarya/firefox/src/content/base/src/nsINode.cpp:1100 #13 0x7f8d0ae5ee30 in nsContentUtils::DispatchEvent(nsIDocument*, nsISupports*, nsAString_internal const&, bool, bool, bool, bool*) /usr/local/google/home/aarya/firefox/src/content/base/src/nsContentUtils.cpp:3551 #14 0x7f8d0ae5e104 in nsContentUtils::DispatchTrustedEvent(nsIDocument*, nsISupports*, nsAString_internal const&, bool, bool, bool*) /usr/local/google/home/aarya/firefox/src/content/base/src/nsContentUtils.cpp:3521 #15 0x7f8d0c0808d2 in nsAsyncDOMEvent::Run() /usr/local/google/home/aarya/firefox/src/content/events/src/nsAsyncDOMEvent.cpp:40 #16 0x7f8d17c85d6f in nsThread::ProcessNextEvent(bool, bool*) /usr/local/google/home/aarya/firefox/src/xpcom/threads/nsThread.cpp:627 #17 0x7f8d178f7ad5 in NS_ProcessNextEvent_P(nsIThread*, bool) /usr/local/google/home/aarya/firefox/src/objdir-ff-asan-sym/xpcom/build/nsThreadUtils.cpp:238 #18 0x7f8d1421e00c in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /usr/local/google/home/aarya/firefox/src/ipc/glue/MessagePump.cpp:82 #19 0x7f8d17f7c562 in MessageLoop::RunInternal() /usr/local/google/home/aarya/firefox/src/ipc/chromium/src/base/message_loop.cc:215 #20 0x7f8d17f7c399 in MessageLoop::RunHandler() /usr/local/google/home/aarya/firefox/src/ipc/chromium/src/base/message_loop.cc:208 #21 0x7f8d17f7c26e in MessageLoop::Run() /usr/local/google/home/aarya/firefox/src/ipc/chromium/src/base/message_loop.cc:182 #22 0x7f8d135dc6d7 in nsBaseAppShell::Run() /usr/local/google/home/aarya/firefox/src/widget/xpwidgets/nsBaseAppShell.cpp:163 #23 0x7f8d120d9f65 in nsAppStartup::Run() /usr/local/google/home/aarya/firefox/src/toolkit/components/startup/nsAppStartup.cpp:288 #24 0x7f8d07262174 in XREMain::XRE_mainRun() /usr/local/google/home/aarya/firefox/src/toolkit/xre/nsAppRunner.cpp:3871 #25 0x7f8d07267d5a in XREMain::XRE_main(int, char**, nsXREAppData const*) /usr/local/google/home/aarya/firefox/src/toolkit/xre/nsAppRunner.cpp:3938 #26 0x7f8d0726ab30 in XRE_main /usr/local/google/home/aarya/firefox/src/toolkit/xre/nsAppRunner.cpp:4141 #27 0x422994 in do_main(int, char**, nsIFile*) /usr/local/google/home/aarya/firefox/src/browser/app/nsBrowserApp.cpp:224 #28 0x41f7c2 in main /usr/local/google/home/aarya/firefox/src/browser/app/nsBrowserApp.cpp:522 #29 0x7f8d2aaea76c in #30 0x41eed4 in 0x6028002a14d0 is located 80 bytes inside of 128-byte region [0x6028002a1480,0x6028002a1500) freed by thread T0 here: #0 0x413ae2 in __interceptor_free #1 0x7f8d28764499 in moz_free /usr/local/google/home/aarya/firefox/src/memory/mozalloc/mozalloc.cpp:48 #2 0x7f8d08dc2090 in operator delete(void*) /usr/local/google/home/aarya/firefox/src/../../dist/include/mozilla/mozalloc.h:225 #3 0x7f8d08dc2090 in mozilla::image::VectorImage::~VectorImage() /usr/local/google/home/aarya/firefox/src/image/src/VectorImage.cpp:304 #4 0x7f8d08dc0ba5 in mozilla::image::VectorImage::Release() /usr/local/google/home/aarya/firefox/src/image/src/VectorImage.cpp:283 #5 0x7f8d08e8a64f in nsRefPtrmozilla::image::Image::~nsRefPtr() /usr/local/google/home/aarya/firefox/src/../../dist/include/nsAutoPtr.h:880 #6 0x7f8d08e75839 in nsRefPtrmozilla::image::Image::~nsRefPtr() /usr/local/google/home/aarya/firefox/src/../../dist/include/nsAutoPtr.h:878 #7 0x7f8d08e75668 in imgRequest::~imgRequest() /usr/local/google/home/aarya/firefox/src/image/src/imgRequest.cpp:96 #8 0x7f8d08e7501f in imgRequest::~imgRequest() /usr/local/google/home/aarya/firefox/src/image/src/imgRequest.cpp:89 #9 0x7f8d08e732e5 in imgRequest::Release() /usr/local/google/home/aarya/firefox/src/image/src/imgRequest.cpp:69 #10 0x7f8d08e6466f in nsRefPtr<imgRequest>::~nsRefPtr() /usr/local/google/home/aarya/firefox/src/../../dist/include/nsAutoPtr.h:880 #11 0x7f8d08dfd3e9 in nsRefPtr<imgRequest>::~nsRefPtr() /usr/local/google/home/aarya/firefox/src/../../dist/include/nsAutoPtr.h:878 #12 0x7f8d08eb1921 in RequestBehaviour::~RequestBehaviour() /usr/local/google/home/aarya/firefox/src/image/src/imgRequestProxy.cpp:43 #13 0x7f8d08ea6799 in RequestBehaviour::~RequestBehaviour() /usr/local/google/home/aarya/firefox/src/image/src/imgRequestProxy.cpp:43 #14 0x7f8d08ea68cf in RequestBehaviour::~RequestBehaviour() /usr/local/google/home/aarya/firefox/src/image/src/imgRequestProxy.cpp:43 #15 0x7f8d08eb0dc0 in nsAutoPtr<ProxyBehaviour>::~nsAutoPtr() /usr/local/google/home/aarya/firefox/src/../../dist/include/nsAutoPtr.h:77 #16 0x7f8d08e92f59 in nsAutoPtr<ProxyBehaviour>::~nsAutoPtr() /usr/local/google/home/aarya/firefox/src/../../dist/include/nsAutoPtr.h:76 #17 0x7f8d08e927ee in imgRequestProxy::~imgRequestProxy() /usr/local/google/home/aarya/firefox/src/image/src/imgRequestProxy.cpp:149 #18 0x7f8d08e9234f in imgRequestProxy::~imgRequestProxy() /usr/local/google/home/aarya/firefox/src/image/src/imgRequestProxy.cpp:123 #19 0x7f8d08e8fad5 in imgRequestProxy::Release() /usr/local/google/home/aarya/firefox/src/image/src/imgRequestProxy.cpp:93 #20 0x7f8d08eafc91 in nsRunnableMethodReceiver<imgRequestProxy, true>::Revoke() /usr/local/google/home/aarya/firefox/src/../../dist/include/nsThreadUtils.h:322 #21 0x7f8d08eb0169 in nsRunnableMethodReceiver<imgRequestProxy, true>::~nsRunnableMethodReceiver() /usr/local/google/home/aarya/firefox/src/../../dist/include/nsThreadUtils.h:321 #22 0x7f8d08eaff49 in nsRunnableMethodReceiver<imgRequestProxy, true>::~nsRunnableMethodReceiver() /usr/local/google/home/aarya/firefox/src/../../dist/include/nsThreadUtils.h:321 #23 0x7f8d08eafe31 in nsRunnableMethodImpl<void (imgRequestProxy::)(), true>::~nsRunnableMethodImpl() /usr/local/google/home/aarya/firefox/src/../../dist/include/nsThreadUtils.h:351 #24 0x7f8d08eaf7d9 in nsRunnableMethodImpl<void (imgRequestProxy::)(), true>::~nsRunnableMethodImpl() /usr/local/google/home/aarya/firefox/src/../../dist/include/nsThreadUtils.h:351 #25 0x7f8d08eaf90f in nsRunnableMethodImpl<void (imgRequestProxy::)(), true>::~nsRunnableMethodImpl() /usr/local/google/home/aarya/firefox/src/../../dist/include/nsThreadUtils.h:351 #26 0x7f8d178f3d25 in nsRunnable::Release() /usr/local/google/home/aarya/firefox/src/objdir-ff-asan-sym/xpcom/build/nsThreadUtils.cpp:31 #27 0x7f8d0722b13f in nsCOMPtr_base::~nsCOMPtr_base() /usr/local/google/home/aarya/firefox/src/objdir-ff-asan-sym/media/webrtc/signaling/signaling_ecc/../../../../dist/include/nsCOMPtr.h:410 #28 0x7f8d072ca67c in nsCOMPtr<nsIRunnable>::~nsCOMPtr() /usr/local/google/home/aarya/firefox/src/../../dist/include/nsCOMPtr.h:449 #29 0x7f8d072c5dd9 in nsCOMPtr<nsIRunnable>::~nsCOMPtr() /usr/local/google/home/aarya/firefox/src/../../dist/include/nsCOMPtr.h:449 #30 0x7f8d17c85e6f in nsThread::ProcessNextEvent(bool, bool) /usr/local/google/home/aarya/firefox/src/xpcom/threads/nsThread.cpp:633 previously allocated by thread T0 here: #0 0x413bc2 in malloc #1 0x7f8d287645e4 in moz_xmalloc /usr/local/google/home/aarya/firefox/src/memory/mozalloc/mozalloc.cpp:54 #2 0x7f8d08d0b32a in operator new(unsigned long) /usr/local/google/home/aarya/firefox/src/../../dist/include/mozilla/mozalloc.h:201 #3 0x7f8d08d0b32a in mozilla::image::ImageFactory::CreateVectorImage(nsIRequest*, imgStatusTracker*, nsCString const&, nsIURI*, unsigned int, unsigned int) /usr/local/google/home/aarya/firefox/src/image/src/ImageFactory.cpp:189 #4 0x7f8d08d09d8b in mozilla::image::ImageFactory::CreateImage(nsIRequest*, imgStatusTracker*, nsCString const&, nsIURI*, bool, unsigned int) /usr/local/google/home/aarya/firefox/src/image/src/ImageFactory.cpp:99 #5 0x7f8d08e846de in imgRequest::OnDataAvailable(nsIRequest*, nsISupports*, nsIInputStream*, unsigned long, unsigned int) /usr/local/google/home/aarya/firefox/src/image/src/imgRequest.cpp:774 #6 0x7f8d08e360a5 in ProxyListener::OnDataAvailable(nsIRequest*, nsISupports*, nsIInputStream*, unsigned long, unsigned int) /usr/local/google/home/aarya/firefox/src/image/src/imgLoader.cpp:2139 #7 0x7f8d073dbc10 in nsBaseChannel::OnDataAvailable(nsIRequest*, nsISupports*, nsIInputStream*, unsigned long, unsigned int) /usr/local/google/home/aarya/firefox/src/netwerk/base/src/nsBaseChannel.cpp:764 #8 0x7f8d073dc572 in non-virtual thunk to nsBaseChannel::OnDataAvailable(nsIRequest*, nsISupports*, nsIInputStream*, unsigned long, unsigned int) /usr/local/google/home/aarya/firefox/src/netwerk/base/src/nsBaseChannel.cpp:772 #9 0x7f8d0748c408 in nsInputStreamPump::OnStateTransfer() /usr/local/google/home/aarya/firefox/src/netwerk/base/src/nsInputStreamPump.cpp:483 #10 0x7f8d0748a4dd in nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*) /usr/local/google/home/aarya/firefox/src/netwerk/base/src/nsInputStreamPump.cpp:372 #11 0x7f8d0748db59 in non-virtual thunk to nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*) /usr/local/google/home/aarya/firefox/src/netwerk/base/src/nsInputStreamPump.cpp:398 #12 0x7f8d17b67239 in nsInputStreamReadyEvent::Run() /usr/local/google/home/aarya/firefox/src/xpcom/io/nsStreamUtils.cpp:82 #13 0x7f8d17c85d6f in nsThread::ProcessNextEvent(bool, bool*) /usr/local/google/home/aarya/firefox/src/xpcom/threads/nsThread.cpp:627 #14 0x7f8d178f7ad5 in NS_ProcessNextEvent_P(nsIThread*, bool) /usr/local/google/home/aarya/firefox/src/objdir-ff-asan-sym/xpcom/build/nsThreadUtils.cpp:238 #15 0x7f8d1421e00c in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /usr/local/google/home/aarya/firefox/src/ipc/glue/MessagePump.cpp:82 #16 0x7f8d17f7c562 in MessageLoop::RunInternal() /usr/local/google/home/aarya/firefox/src/ipc/chromium/src/base/message_loop.cc:215 #17 0x7f8d17f7c399 in MessageLoop::RunHandler() /usr/local/google/home/aarya/firefox/src/ipc/chromium/src/base/message_loop.cc:208 #18 0x7f8d17f7c26e in MessageLoop::Run() /usr/local/google/home/aarya/firefox/src/ipc/chromium/src/base/message_loop.cc:182 #19 0x7f8d135dc6d7 in nsBaseAppShell::Run() /usr/local/google/home/aarya/firefox/src/widget/xpwidgets/nsBaseAppShell.cpp:163 #20 0x7f8d120d9f65 in nsAppStartup::Run() /usr/local/google/home/aarya/firefox/src/toolkit/components/startup/nsAppStartup.cpp:288 #21 0x7f8d07262174 in XREMain::XRE_mainRun() /usr/local/google/home/aarya/firefox/src/toolkit/xre/nsAppRunner.cpp:3871 #22 0x7f8d07267d5a in XREMain::XRE_main(int, char**, nsXREAppData const*) /usr/local/google/home/aarya/firefox/src/toolkit/xre/nsAppRunner.cpp:3938 #23 0x7f8d0726ab30 in XRE_main /usr/local/google/home/aarya/firefox/src/toolkit/xre/nsAppRunner.cpp:4141 #24 0x422994 in do_main(int, char**, nsIFile*) /usr/local/google/home/aarya/firefox/src/browser/app/nsBrowserApp.cpp:224 #25 0x41f7c2 in main /usr/local/google/home/aarya/firefox/src/browser/app/nsBrowserApp.cpp:522 #26 0x7f8d2aaea76c in Shadow bytes around the buggy address: 0x1c0500054240: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd 0x1c0500054250: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa 0x1c0500054260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1c0500054270: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 0x1c0500054280: 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa =>0x1c0500054290: fd fd fd fd fd fd fd fd fd fd[fd]fd fd fd fd fd 0x1c05000542a0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 0x1c05000542b0: 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa 0x1c05000542c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1c05000542d0: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd 0x1c05000542e0: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa 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 righ 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 ==18126== ABORTING

The original report as published on Mozilla's Bugzilla, by Abhishek Arya. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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 Graphics: ImageLib. Mozilla made it public on 26 February 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.

More by Abhishek Arya

View all

130 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.