Skip to content
Memory corruption Disclosed report

Heap-use-after-free in nsFrameSelection::cycleCollection::TraverseImpl

Abhishek Arya Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 34 days
  • Paid in 40 days
  • Disclosed after 34 days

Created attachment 686361 Testcase

==994== ERROR: AddressSanitizer: heap-use-after-free on address 0x7f7ed81c7e48 at pc 0x7f7f012e2e65 bp 0x7f7ef02d7a90 sp 0x7f7ef02d7a88 READ of size 8 at 0x7f7ed81c7e48 thread T4 #0 0x7f7f012e2e64 in nsIPresShell::GetDocument() const src/../../../dist/include/nsIPresShell.h:271 #1 0x7f7f01e7fc21 in nsFrameSelection::cycleCollection::TraverseImpl(nsFrameSelection::cycleCollection*, void*, nsCycleCollectionTraversalCallback&) src/layout/generic/nsSelection.cpp:513 #2 0x7f7f0de2c27f in nsCycleCollectionParticipant::Traverse(void*, nsCycleCollectionTraversalCallback&) src/../../dist/include/nsCycleCollectionParticipant.h:201 #3 0x7f7f0de2bb44 in GCGraphBuilder::Traverse(PtrInfo*) src/xpcom/base/nsCycleCollector.cpp:1856 #4 0x7f7f0de330d7 in nsCycleCollector::MarkRoots(GCGraphBuilder&) src/xpcom/base/nsCycleCollector.cpp:2171 #5 0x7f7f0de3da84 in nsCycleCollector::BeginCollection(bool, nsICycleCollectorListener*) src/xpcom/base/nsCycleCollector.cpp:2850 #6 0x7f7f0de5b6d5 in nsCycleCollectorRunner::Run() src/xpcom/base/nsCycleCollector.cpp:3208 #7 0x7f7f0dd8332e in nsThread::ProcessNextEvent(bool, bool*) src/xpcom/threads/nsThread.cpp:627 #8 0x7f7f0d9f8f7f in NS_ProcessNextEvent_P(nsIThread*, bool) src/objdir-ff-asan-sym/xpcom/build/nsThreadUtils.cpp:221 #9 0x7f7f0dd7afc4 in nsThread::ThreadFunc(void*) src/xpcom/threads/nsThread.cpp:265 #10 0x7f7f1f58c306 in _pt_root src/nsprpub/pr/src/pthreads/ptthread.c:156 #11 0x4c672a in __asan::AsanThread::ThreadStart() 0x7f7ed81c7e48 is located 8 bytes inside of 416-byte region [0x7f7ed81c7e40,0x7f7ed81c7fe0) freed by thread T0 here: #0 0x4c3750 in __interceptor_free #1 0x7f7f1d39b405 in moz_free src/memory/mozalloc/mozalloc.cpp:48 #2 0x7f7f017bf9eb in operator delete(void*) src/../../dist/include/mozilla/mozalloc.h:224 #3 0x7f7f017bf9eb in PresShell::operator delete(void*) src/layout/base/nsPresShell.h:65 #4 0x7f7f017bf85b in PresShell::~PresShell() src/layout/base/nsPresShell.cpp:755 #5 0x7f7f017be4f2 in PresShell::Release() src/layout/base/nsPresShell.cpp:749 #6 0x7f7eff6b59ce in nsCOMPtr_base::assign_assuming_AddRef(nsISupports*) src/../../dist/include/nsCOMPtr.h:442 #7 0x7f7f0d9b082a in nsCOMPtr_base::assign_with_AddRef(nsISupports*) src/objdir-ff-asan-sym/xpcom/build/nsCOMPtr.cpp:49 #8 0x7f7f0162e098 in nsCOMPtr<nsIPresShell>::operator=(nsIPresShell*) src/../../dist/include/nsCOMPtr.h:624 #9 0x7f7f0161c1a2 in DocumentViewerImpl::DestroyPresShell() src/layout/base/nsDocumentViewer.cpp:4367 #10 0x7f7f01619e84 in DocumentViewerImpl::Destroy() src/layout/base/nsDocumentViewer.cpp:1664 #11 0x7f7f01622c16 in DocumentViewerImpl::Show() src/layout/base/nsDocumentViewer.cpp:1938 #12 0x7f7f01781ebb in nsPresContext::EnsureVisible() src/layout/base/nsPresContext.cpp:1825 #13 0x7f7f01808372 in PresShell::UnsuppressAndInvalidate() src/layout/base/nsPresShell.cpp:3575 #14 0x7f7f0180900c in PresShell::UnsuppressPainting() src/layout/base/nsPresShell.cpp:3626 #15 0x7f7f0160ba08 in DocumentViewerImpl::LoadComplete(tag_nsresult) src/layout/base/nsDocumentViewer.cpp:1069 previously allocated by thread T0 here: #0 0x4c3810 in malloc #1 0x7f7f1d39b541 in moz_xmalloc src/memory/mozalloc/mozalloc.cpp:54 #2 0x7f7f017bc811 in operator new(unsigned long) src/../../dist/include/mozilla/mozalloc.h:200 #3 0x7f7f017bc811 in PresShell::operator new(unsigned long) src/layout/base/nsPresShell.h:65 #4 0x7f7f017bc439 in NS_NewPresShell(nsIPresShell**) src/layout/base/nsPresShell.cpp:695 #5 0x7f7f0310821f in nsDocument::doCreateShell(nsPresContext*, nsIViewManager*, nsStyleSet*, nsCompatibility, nsIPresShell**) src/content/base/src/nsDocument.cpp:3075 #6 0x7f7f050ae21d in nsHTMLDocument::CreateShell(nsPresContext*, nsIViewManager*, nsStyleSet*, nsIPresShell**) src/content/html/document/src/nsHTMLDocument.cpp:312 #7 0x7f7f016011e1 in DocumentViewerImpl::InitPresentationStuff(bool) src/layout/base/nsDocumentViewer.cpp:705 #8 0x7f7f01600282 in DocumentViewerImpl::InitInternal(nsIWidget*, nsISupports*, nsIntRect const&, bool, bool, bool) src/layout/base/nsDocumentViewer.cpp:952 #9 0x7f7f015fd86f in DocumentViewerImpl::Init(nsIWidget*, nsIntRect const&) src/layout/base/nsDocumentViewer.cpp:686 Thread T4 created by T0 here: #0 0x4bfa14 in __interceptor_pthread_create #1 0x7f7f1f57d6b5 in _PR_CreateThread src/nsprpub/pr/src/pthreads/ptthread.c:393 #2 0x7f7f1f57b4a6 in PR_CreateThread src/nsprpub/pr/src/pthreads/ptthread.c:476 #3 0x7f7f0dd7e050 in nsThread::Init() src/xpcom/threads/nsThread.cpp:331 #4 0x7f7f0dd95918 in nsThreadManager::NewThread(unsigned int, unsigned int, nsIThread**) src/xpcom/threads/nsThreadManager.cpp:215 #5 0x7f7f0d9f66f1 in NS_NewThread_P(nsIThread**, nsIRunnable*, unsigned int) src/objdir-ff-asan-sym/xpcom/build/nsThreadUtils.cpp:50 #6 0x7f7f0de41c3b in nsCycleCollector_startup() src/xpcom/base/nsCycleCollector.cpp:3311 #7 0x7f7f0da36d30 in NS_InitXPCOM2_P src/xpcom/build/nsXPComInit.cpp:443 #8 0x7f7eff5686a0 in ScopedXPCOMStartup::Initialize() src/toolkit/xre/nsAppRunner.cpp:1183 #9 0x7f7eff597629 in XREMain::XRE_main(int, char**, nsXREAppData const*) src/toolkit/xre/nsAppRunner.cpp:3886 #10 0x7f7eff59a620 in XRE_main src/toolkit/xre/nsAppRunner.cpp:4084 #11 0x40c0c6 in do_main(int, char**) src/browser/app/nsBrowserApp.cpp:174 #12 0x409900 in main src/browser/app/nsBrowserApp.cpp:279 #13 0x7f7f1f80d76c in Shadow byte and word: 0x1fefdb038fc9: fd 0x1fefdb038fc8: fd fd fd fd fd fd fd fd More shadow bytes: 0x1fefdb038fa8: fa fa fa fa fa fa fa fa 0x1fefdb038fb0: fa fa fa fa fa fa fa fa 0x1fefdb038fb8: fa fa fa fa fa fa fa fa 0x1fefdb038fc0: fa fa fa fa fa fa fa fa =>0x1fefdb038fc8: fd fd fd fd fd fd fd fd 0x1fefdb038fd0: fd fd fd fd fd fd fd fd 0x1fefdb038fd8: fd fd fd fd fd fd fd fd 0x1fefdb038fe0: fd fd fd fd fd fd fd fd 0x1fefdb038fe8: fd fd fd fd fd fd fd fd Stats: 276M malloced (258M for red zones) by 458491 calls Stats: 49M realloced by 26124 calls Stats: 250M freed by 347463 calls Stats: 218M really freed by 215147 calls Stats: 256M (65635 full pages) mmaped in 489 calls mmaps by size class: 7:167895; 8:49128; 9:15345; 10:10220; 11:8670; 12:1280; 13:1600; 14:512; 15:224; 16:792; 17:468; 18:36; 19:35; 20:21; mallocs by size class: 7:278568; 8:100263; 9:30963; 10:15158; 11:22702; 12:2799; 13:2980; 14:1618; 15:418; 16:1508; 17:1376; 18:72; 19:42; 20:24; frees by size class: 7:207134; 8:72641; 9:25000; 10:12209; 11:20982; 12:2073; 13:2812; 14:1425; 15:294; 16:1415; 17:1361; 18:58; 19:39; 20:20; rfrees by size class: 7:118307; 8:52096; 9:16065; 10:5384; 11:15900; 12:1641; 13:1448; 14:1348; 15:268; 16:1233; 17:1345; 18:55; 19:38; 20:19; Stats: malloc large: 3440 small slow: 6210 ==994== 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 Layout. Mozilla made it public on 1 January 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.