Skip to content
Memory corruption Disclosed report CVE-2012-4181

Heap-use-after-free in nsSMILAnimationController::DoSample

Abhishek Arya Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 38 hours
  • Paid in 5 months
  • Disclosed after 38 hours

Created attachment 655825 Testcase

Reproduces on trunk. Reliable reproduce this by launching multiple instances of firefox with the same testcase. on my fast box, i needed like 15.

================================================================= ==10320== ERROR: AddressSanitizer heap-use-after-free on address 0x7f2197da95d0 at pc 0x7f21c591cd12 bp 0x7ffff4c086b0 sp 0x7ffff4c086a8 READ of size 4 at 0x7f2197da95d0 thread T0 #0 0x7f21c591cd11 in PL_DHashTableEnumerate src/objdir-ff-asan-sym/xpcom/build/pldhash.cpp:714 #1 0x7f21c0d411d2 in nsTHashtable<nsSMILCompositor>::EnumerateEntries(PLDHashOperator ()(nsSMILCompositor, void*), void*) src/../../dist/include/nsTHashtable.h:237 #2 0x7f21c0d43762 in nsSMILAnimationController::DoSample(bool) src/content/smil/nsSMILAnimationController.cpp:437 #3 0x7f21baadbc47 in nsSMILAnimationController::Resample() src/../../../../dist/include/nsSMILAnimationController.h:66 #4 0x7f21baa4930d in nsSMILAnimationController::FlushResampleRequests() src/../../../../dist/include/nsSMILAnimationController.h:84 #5 0x7f21baa47fbe in PresShell::FlushPendingNotifications(mozFlushType) src/layout/base/nsPresShell.cpp:3846 #6 0x7f21bb16d5aa in nsHideViewer::Run() src/layout/generic/nsSubDocumentFrame.cpp:810 #7 0x7f21bc09650d in nsContentUtils::RemoveScriptBlocker() src/content/base/src/nsContentUtils.cpp:4961 #8 0x7f21ba679a3a in ~nsAutoScriptBlocker src/../../../dist/include/nsContentUtils.h:2276 #9 0x7f21ba664432 in ~nsAutoScriptBlocker src/../../../dist/include/nsContentUtils.h:2275 #10 0x7f21bc2a34a1 in nsDocument::AdoptNode(nsIDOMNode*, nsIDOMNode**) src/content/base/src/nsDocument.cpp:6227 #11 0x7f21c133969d in nsIDOMDocument_AdoptNode(JSContext*, unsigned int, JS::Value*) src/objdir-ff-asan-sym/js/xpconnect/src/dom_quickstubs.cpp:3467 #12 0x7f21cc8bf951 in js::CallJSNative(JSContext*, int ()(JSContext, unsigned int, JS::Value*), JS::CallArgs const&) src/js/src/jscntxtinlines.h:372 #13 0x7f21cc84ca41 in js::Interpret(JSContext*, js::StackFrame*, js::InterpMode) src/js/src/jsinterp.cpp:2413 #14 0x7f21cc7b3a35 in js::RunScript(JSContext*, JSScript*, js::StackFrame*) src/js/src/jsinterp.cpp:309 #15 0x7f21cc8ccc66 in js::ExecuteKernel(JSContext*, JS::Handle<JSScript*>, JSObject&, JS::Value const&, js::ExecuteType, js::StackFrame*, JS::Value*) src/js/src/jsinterp.cpp:494 #16 0x7f21cc8cec1e in js::Execute(JSContext*, JS::Handle<JSScript*>, JSObject&, JS::Value*) src/js/src/jsinterp.cpp:531 #17 0x7f21cc026334 in JS::Evaluate(JSContext*, JS::Handle<JSObject*>, JS::CompileOptions, unsigned short const*, unsigned long, JS::Value*) src/js/src/jsapi.cpp:5665 #18 0x7f21cc02b2d1 in JS_EvaluateUCScriptForPrincipalsVersionOrigin src/js/src/jsapi.cpp:5746 #19 0x7f21be34f62f in nsJSContext::EvaluateString(nsAString_internal const&, JSObject*, nsIPrincipal*, nsIPrincipal*, char const*, unsigned int, JSVersion, nsAString_internal*, bool*) src/dom/base/nsJSEnvironment.cpp:1497 #20 0x7f21be4ff1bf in nsGlobalWindow::RunTimeoutHandler(nsTimeout*, nsIScriptContext*) src/dom/base/nsGlobalWindow.cpp:9590 #21 0x7f21be4b6b39 in nsGlobalWindow::RunTimeout(nsTimeout*) src/dom/base/nsGlobalWindow.cpp:9851 #22 0x7f21be4fd21a in nsGlobalWindow::TimerCallback(nsITimer*, void*) src/dom/base/nsGlobalWindow.cpp:10118 #23 0x7f21c5ca0d22 in nsTimerImpl::Fire() src/xpcom/threads/nsTimerImpl.cpp:473 #24 0x7f21c5ca25d8 in nsTimerEvent::Run() src/xpcom/threads/nsTimerImpl.cpp:556 #25 0x7f21c5c659ce in nsThread::ProcessNextEvent(bool, bool*) src/xpcom/threads/nsThread.cpp:624 #26 0x7f21c5906e27 in NS_ProcessNextEvent_P(nsIThread*, bool) src/objdir-ff-asan-sym/xpcom/build/nsThreadUtils.cpp:220 #27 0x7f21c46e3595 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) src/ipc/glue/MessagePump.cpp:82 #28 0x7f21c5f12bd9 in MessageLoop::RunInternal() src/ipc/chromium/src/base/message_loop.cc:208 #29 0x7f21c5f12a22 in MessageLoop::RunHandler() src/ipc/chromium/src/base/message_loop.cc:201 #30 0x7f21c5f12907 in MessageLoop::Run() src/ipc/chromium/src/base/message_loop.cc:175 #31 0x7f21c3bad7ae in nsBaseAppShell::Run() src/widget/xpwidgets/nsBaseAppShell.cpp:163 #32 0x7f21c281e448 in nsAppStartup::Run() src/toolkit/components/startup/nsAppStartup.cpp:273 #33 0x7f21b90259b0 in XREMain::XRE_mainRun() src/toolkit/xre/nsAppRunner.cpp:3800 #34 0x7f21b902bc24 in XREMain::XRE_main(int, char**, nsXREAppData const*) src/toolkit/xre/nsAppRunner.cpp:3877 #35 0x7f21b902ecee in XRE_main src/toolkit/xre/nsAppRunner.cpp:3953 #36 0x40c5bb in do_main(int, char**) src/browser/app/nsBrowserApp.cpp:174 #37 0x409e1f in main src/browser/app/nsBrowserApp.cpp:279 #38 0x7f21d60e6c4d in ?? ??:0 0x7f2197da95d0 is located 336 bytes inside of 896-byte region [0x7f2197da9480,0x7f2197da9800) freed by thread T0 here: #0 0x4c3e30 in free ??:0 #1 0x7f21d2f84572 in moz_free src/memory/mozalloc/mozalloc.cpp:51 #2 0x7f21c59125d0 in PL_DHashFreeTable src/objdir-ff-asan-sym/xpcom/build/pldhash.cpp:88 #3 0x7f21c5915ae1 in PL_DHashTableFinish src/objdir-ff-asan-sym/xpcom/build/pldhash.cpp:370 #4 0x7f21c0d533f1 in ~nsTHashtable src/../../dist/include/nsTHashtable.h:384 #5 0x7f21c0d53272 in ~nsTHashtable src/../../dist/include/nsTHashtable.h:382 #6 0x7f21c0d53093 in nsAutoPtr<nsTHashtable<nsSMILCompositor> >::assign(nsTHashtable<nsSMILCompositor>) src/../../dist/include/nsAutoPtr.h:38 #7 0x7f21c0d416f7 in nsAutoPtr<nsTHashtable<nsSMILCompositor> >::operator=(nsTHashtable<nsSMILCompositor>) src/../../dist/include/nsAutoPtr.h:101 #8 0x7f21c0d43816 in nsSMILAnimationController::DoSample(bool) src/content/smil/nsSMILAnimationController.cpp:449 #9 0x7f21c0d42e97 in nsSMILAnimationController::DoSample() src/content/smil/nsSMILAnimationController.cpp:351 #10 0x7f21c0db7c95 in nsSMILTimeContainer::Sample() src/content/smil/nsSMILTimeContainer.cpp:176 #11 0x7f21c0d3e5c6 in nsSMILAnimationController::Resume(unsigned int) src/content/smil/nsSMILAnimationController.cpp:94 #12 0x7f21c0d40987 in nsSMILAnimationController::OnPageShow() src/content/smil/nsSMILAnimationController.cpp:193 #13 0x7f21bc2bf2a8 in nsDocument::OnPageShow(bool, nsIDOMEventTarget*) src/content/base/src/nsDocument.cpp:7306 #14 0x7f21ba862325 in DocumentViewerImpl::LoadComplete(unsigned int) src/layout/base/nsDocumentViewer.cpp:1045 #15 0x7f21c229a6da in nsDocShell::EndPageLoad(nsIWebProgress*, nsIChannel*, unsigned int) src/docshell/base/nsDocShell.cpp:6415 #16 0x7f21c22925e5 in nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, unsigned int) src/docshell/base/nsDocShell.cpp:6246 #17 0x7f21c22935d4 in non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, unsigned int) src/build/unix/stdc++compat/stdc++compat.cpp:0 #18 0x7f21c23993e6 in nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, unsigned int) src/uriloader/base/nsDocLoader.cpp:1351 #19 0x7f21c2396d13 in nsDocLoader::doStopDocumentLoad(nsIRequest*, unsigned int) src/uriloader/base/nsDocLoader.cpp:931 #20 0x7f21c2390316 in nsDocLoader::DocLoaderIsEmpty(bool) src/uriloader/base/nsDocLoader.cpp:820 #21 0x7f21c2397329 in nsDocLoader::ChildDoneWithOnload(nsIDocumentLoader*) src/uriloader/base/nsDocLoader.h:193 #22 0x7f21c2390356 in nsDocLoader::DocLoaderIsEmpty(bool) src/uriloader/base/nsDocLoader.cpp:823 #23 0x7f21c2394724 in nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, unsigned int) src/uriloader/base/nsDocLoader.cpp:704 #24 0x7f21c2395f7c in non-virtual thunk to nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, unsigned int) src/build/unix/stdc++compat/stdc++compat.cpp:0 #25 0x7f21b9255852 in nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, unsigned int) src/netwerk/base/src/nsLoadGroup.cpp:698 #26 0x7f21b924c2bc in nsLoadGroup::Cancel(unsigned int) src/netwerk/base/src/nsLoadGroup.cpp:304 #27 0x7f21c238eeef in nsDocLoader::Stop() src/uriloader/base/nsDocLoader.cpp:328 #28 0x7f21c2319965 in nsDocShell::Stop() src/docshell/base/nsDocShell.h:189 #29 0x7f21c2267db7 in nsDocShell::Stop(unsigned int) src/docshell/base/nsDocShell.cpp:4541 previously allocated by thread T0 here: #0 0x4c3ef0 in __interceptor_malloc ??:0 #1 0x7f21d2f849d2 in moz_malloc src/memory/mozalloc/mozalloc.cpp:67 #2 0x7f21c591245d in PL_DHashAllocTable src/objdir-ff-asan-sym/xpcom/build/pldhash.cpp:82 #3 0x7f21c5914bd3 in PL_DHashTableInit src/objdir-ff-asan-sym/xpcom/build/pldhash.cpp:229 #4 0x7f21c0d4e36c in nsTHashtable<nsSMILCompositor>::Init(unsigned int, mozilla::fallible_t const&) src/../../dist/include/nsTHashtable.h:414 #5 0x7f21c0d45e25 in nsTHashtable<nsSMILCompositor>::Init(unsigned int) src/../../dist/include/nsTHashtable.h:98 #6 0x7f21c0d435d1 in nsSMILAnimationController::DoSample(bool) src/content/smil/nsSMILAnimationController.cpp:413 #7 0x7f21baadbc47 in nsSMILAnimationController::Resample() src/../../../../dist/include/nsSMILAnimationController.h:66 #8 0x7f21baa4930d in nsSMILAnimationController::FlushResampleRequests() src/../../../../dist/include/nsSMILAnimationController.h:84 #9 0x7f21baa47fbe in PresShell::FlushPendingNotifications(mozFlushType) src/layout/base/nsPresShell.cpp:3846 #10 0x7f21baaea5e7 in nsRefreshDriver::Notify(nsITimer*) src/layout/base/nsRefreshDriver.cpp:378 #11 0x7f21c5ca0de6 in nsTimerImpl::Fire() src/xpcom/threads/nsTimerImpl.cpp:476 #12 0x7f21c5ca25d8 in nsTimerEvent::Run() src/xpcom/threads/nsTimerImpl.cpp:556 #13 0x7f21c5c659ce in nsThread::ProcessNextEvent(bool, bool*) src/xpcom/threads/nsThread.cpp:624 #14 0x7f21c5906e27 in NS_ProcessNextEvent_P(nsIThread*, bool) src/objdir-ff-asan-sym/xpcom/build/nsThreadUtils.cpp:220 #15 0x7f21c46e3595 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) src/ipc/glue/MessagePump.cpp:82 #16 0x7f21c5f12bd9 in MessageLoop::RunInternal() src/ipc/chromium/src/base/message_loop.cc:208 #17 0x7f21c5f12a22 in MessageLoop::RunHandler() src/ipc/chromium/src/base/message_loop.cc:201 #18 0x7f21c5f12907 in MessageLoop::Run() src/ipc/chromium/src/base/message_loop.cc:175 #19 0x7f21c3bad7ae in nsBaseAppShell::Run() src/widget/xpwidgets/nsBaseAppShell.cpp:163 #20 0x7f21c281e448 in nsAppStartup::Run() src/toolkit/components/startup/nsAppStartup.cpp:273 #21 0x7f21b90259b0 in XREMain::XRE_mainRun() src/toolkit/xre/nsAppRunner.cpp:3800 #22 0x7f21b902bc24 in XREMain::XRE_main(int, char**, nsXREAppData const*) src/toolkit/xre/nsAppRunner.cpp:3877 #23 0x7f21b902ecef in XRE_main src/toolkit/xre/nsAppRunner.cpp:3953 Shadow byte and word: 0x1fe432fb52ba: fd 0x1fe432fb52b8: fd fd fd fd fd fd fd fd More shadow bytes: 0x1fe432fb5298: fd fd fd fd fd fd fd fd 0x1fe432fb52a0: fd fd fd fd fd fd fd fd 0x1fe432fb52a8: fd fd fd fd fd fd fd fd 0x1fe432fb52b0: fd fd fd fd fd fd fd fd =>0x1fe432fb52b8: fd fd fd fd fd fd fd fd 0x1fe432fb52c0: fd fd fd fd fd fd fd fd 0x1fe432fb52c8: fd fd fd fd fd fd fd fd 0x1fe432fb52d0: fd fd fd fd fd fd fd fd 0x1fe432fb52d8: fd fd fd fd fd fd fd fd Stats: 220M malloced (219M for red zones) by 289499 calls Stats: 41M realloced by 14348 calls Stats: 192M freed by 181706 calls Stats: 57M really freed by 116880 calls Stats: 412M (105547 full pages) mmaped in 103 calls mmaps by size class: 8:196596; 9:40955; 10:16380; 11:14329; 12:2048; 13:1536; 14:1280; 15:256; 16:320; 17:1248; 18:160; 19:40; 20:16; mallocs by size class: 8:205900; 9:44146; 10:15477; 11:16402; 12:2266; 13:1677; 14:1399; 15:305; 16:403; 17:1293; 18:173; 19:41; 20:17; frees by size class: 8:114002; 9:35563; 10:12435; 11:13502; 12:1490; 13:1439; 14:1233; 15:266; 16:306; 17:1281; 18:136; 19:39; 20:14; rfrees by size class: 8:78488; 9:19256; 10:8038; 11:9093; 12:676; 13:448; 14:316; 15:147; 16:183; 17:201; 18:28; 19:5; 20:1; Stats: malloc large: 1524 small slow: 1617 ==10320== 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 SVG. Mozilla made it public on 29 August 2012 as CVE-2012-4181.

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.