Heap-use-after-free in gfxFont::GetFontEntry
Originally disclosed on Mozilla
- Fixed in 16 days
- Paid in 41 days
- Disclosed after 16 days
Created attachment 668876 Testcase
Reproduces on trunk. Let the simple testcase run for like 2-5 min to see it crash automatically and reliably.
================================================================= ==6069== ERROR: AddressSanitizer heap-use-after-free on address 0x7fdcc8f3a498 at pc 0x7fdcf32ee33e bp 0x7fff3ac5bef0 sp 0x7fff3ac5bee8 READ of size 8 at 0x7fdcc8f3a498 thread T0 #0 0x7fdcf32ee33d in nsRefPtr<gfxFontEntry>::get() const ../../dist/include/nsAutoPtr.h:1003 #1 0x7fdcf3f01350 in gfxFont::GetFontEntry() ../../dist/include/gfxFont.h:1497 #2 0x7fdcfe894c4c in gfxFontCache::HashEntry::KeyEquals(gfxFontCache::Key const*) const gfx/thebes/gfxFont.cpp:1255 #3 0x7fdcfe948699 in nsTHashtablegfxFontCache::HashEntry::s_MatchEntry(PLDHashTable*, PLDHashEntryHdr const*, void const*) ../../dist/include/nsTHashtable.h:440 #4 0x7fdcfdf2e9da in SearchTable(PLDHashTable*, void const*, unsigned int, PLDHashOperator) objdir-ff-asan-sym/xpcom/build/pldhash.cpp:434 #5 0x7fdcfdf2b7c5 in PL_DHashTableOperate objdir-ff-asan-sym/xpcom/build/pldhash.cpp:587 #6 0x7fdcfe895d87 in nsTHashtablegfxFontCache::HashEntry::GetEntry(gfxFontCache::Key const&) const ../../dist/include/nsTHashtable.h:147 #7 0x7fdcfe897532 in gfxFontCache::DestroyFont(gfxFont*) gfx/thebes/gfxFont.cpp:1321 #8 0x7fdcfe8965da in gfxFontCache::NotifyExpired(gfxFont*) gfx/thebes/gfxFont.cpp:1314 #9 0x7fdcfe9470da in nsExpirationTracker<gfxFont, 3u>::AgeOneGeneration() ../../dist/include/nsExpirationTracker.h:188 #10 0x7fdcfe9466b3 in nsExpirationTracker<gfxFont, 3u>::TimerCallback(nsITimer*, void*) ../../dist/include/nsExpirationTracker.h:311 #11 0x7fdcfe2c6832 in nsTimerImpl::Fire() xpcom/threads/nsTimerImpl.cpp:473 #12 0x7fdcfe2c7d3a in nsTimerEvent::Run() xpcom/threads/nsTimerImpl.cpp:556 #13 0x7fdcfe28b440 in nsThread::ProcessNextEvent(bool, bool*) xpcom/threads/nsThread.cpp:612 #14 0x7fdcfdf1c2bb in NS_ProcessNextEvent_P(nsIThread*, bool) objdir-ff-asan-sym/xpcom/build/nsThreadUtils.cpp:220 #15 0x7fdcfc8c7fbd in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) ipc/glue/MessagePump.cpp:117 #16 0x7fdcfe564ab1 in MessageLoop::RunInternal() ipc/chromium/src/base/message_loop.cc:208 #17 0x7fdcfe5648e6 in MessageLoop::RunHandler() ipc/chromium/src/base/message_loop.cc:201 #18 0x7fdcfe5647cb in MessageLoop::Run() ipc/chromium/src/base/message_loop.cc:175 #19 0x7fdcfbd6c3ea in nsBaseAppShell::Run() widget/xpwidgets/nsBaseAppShell.cpp:163 #20 0x7fdcfa9a3df4 in nsAppStartup::Run() toolkit/components/startup/nsAppStartup.cpp:290 #21 0x7fdcf0c7823d in XREMain::XRE_mainRun() toolkit/xre/nsAppRunner.cpp:3782 #22 0x7fdcf0c7e0b5 in XREMain::XRE_main(int, char**, nsXREAppData const*) toolkit/xre/nsAppRunner.cpp:3848 #23 0x7fdcf0c80f64 in XRE_main toolkit/xre/nsAppRunner.cpp:3923 #24 0x40baa3 in do_main(int, char**) browser/app/nsBrowserApp.cpp:174 #25 0x4091e5 in main browser/app/nsBrowserApp.cpp:279 #26 0x7fdd0f01b76c in ?? ??:0 0x7fdcc8f3a498 is located 24 bytes inside of 392-byte region [0x7fdcc8f3a480,0x7fdcc8f3a608) freed by thread T0 here: #0 0x4c3580 in __interceptor_free ??:? #1 0x7fdd0be93406 in moz_free memory/mozalloc/mozalloc.cpp:51 #2 0x7fdcfea9372d in operator delete(void*) ../../dist/include/mozilla/mozalloc.h:224 #3 0x7fdcfe897716 in gfxFontCache::DestroyFont(gfxFont*) gfx/thebes/gfxFont.cpp:1326 #4 0x7fdcfe8965da in gfxFontCache::NotifyExpired(gfxFont*) gfx/thebes/gfxFont.cpp:1314 #5 0x7fdcfe9470da in nsExpirationTracker<gfxFont, 3u>::AgeOneGeneration() ../../dist/include/nsExpirationTracker.h:188 #6 0x7fdcfe9466b3 in nsExpirationTracker<gfxFont, 3u>::TimerCallback(nsITimer*, void*) ../../dist/include/nsExpirationTracker.h:311 #7 0x7fdcfe2c6832 in nsTimerImpl::Fire() xpcom/threads/nsTimerImpl.cpp:473 #8 0x7fdcfe2c7d3a in nsTimerEvent::Run() xpcom/threads/nsTimerImpl.cpp:556 #9 0x7fdcfe28b440 in nsThread::ProcessNextEvent(bool, bool*) xpcom/threads/nsThread.cpp:612 #10 0x7fdcfdf1c2bb in NS_ProcessNextEvent_P(nsIThread*, bool) objdir-ff-asan-sym/xpcom/build/nsThreadUtils.cpp:220 #11 0x7fdcfc8c7fbd in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) ipc/glue/MessagePump.cpp:117 #12 0x7fdcfe564ab1 in MessageLoop::RunInternal() ipc/chromium/src/base/message_loop.cc:208 #13 0x7fdcfe5648e6 in MessageLoop::RunHandler() ipc/chromium/src/base/message_loop.cc:201 #14 0x7fdcfe5647cb in MessageLoop::Run() ipc/chromium/src/base/message_loop.cc:175 #15 0x7fdcfbd6c3ea in nsBaseAppShell::Run() widget/xpwidgets/nsBaseAppShell.cpp:163 #16 0x7fdcfa9a3df4 in nsAppStartup::Run() toolkit/components/startup/nsAppStartup.cpp:290 #17 0x7fdcf0c7823d in XREMain::XRE_mainRun() toolkit/xre/nsAppRunner.cpp:3782 #18 0x7fdcf0c7e0b5 in XREMain::XRE_main(int, char**, nsXREAppData const*) toolkit/xre/nsAppRunner.cpp:3848 #19 0x7fdcf0c80f64 in XRE_main toolkit/xre/nsAppRunner.cpp:3923 #20 0x40baa3 in do_main(int, char**) browser/app/nsBrowserApp.cpp:174 #21 0x4091e5 in main browser/app/nsBrowserApp.cpp:279 #22 0x7fdd0f01b76c in ?? ??:0 previously allocated by thread T0 here: #0 0x4c3640 in malloc ??:? #1 0x7fdd0be9355a in moz_xmalloc memory/mozalloc/mozalloc.cpp:57 #2 0x7fdcfea9b49c in operator new(unsigned long) ../../dist/include/mozilla/mozalloc.h:200 #3 0x7fdcfea8c6d0 in gfxFcFontSet::GetFontAt(unsigned int, gfxFontStyle const*) gfx/thebes/gfxPangoFonts.cpp:1203 #4 0x7fdcfea8b6d8 in gfxPangoFontGroup::GetBaseFontSet() gfx/thebes/gfxPangoFonts.cpp:2503 #5 0x7fdcfea8b038 in gfxPangoFontGroup::GetBaseFont() gfx/thebes/gfxPangoFonts.cpp:1936 #6 0x7fdcfea8ca32 in gfxPangoFontGroup::GetFontAt(int) gfx/thebes/gfxPangoFonts.cpp:1954 #7 0x7fdcf24ae390 in nsFontMetrics::GetMetrics() const gfx/src/nsFontMetrics.cpp:128 #8 0x7fdcf24af6fe in nsFontMetrics::ExternalLeading() gfx/src/nsFontMetrics.cpp:191 #9 0x7fdcf3017179 in GetNormalLineHeight(nsFontMetrics*) layout/generic/nsHTMLReflowState.cpp:2331 #10 0x7fdcf3015eef in ComputeLineHeight(nsStyleContext*, int, float) layout/generic/nsHTMLReflowState.cpp:2389 #11 0x7fdcf301521c in nsHTMLReflowState::CalcLineHeight(nsStyleContext*, int, float) layout/generic/nsHTMLReflowState.cpp:2411 #12 0x7fdcf3014f08 in nsHTMLReflowState::CalcLineHeight() const layout/generic/nsHTMLReflowState.cpp:2400 #13 0x7fdcf2db4b27 in nsBlockReflowState layout/generic/nsBlockReflowState.cpp:113 #14 0x7fdcf2d21d1c in nsBlockFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&) layout/generic/nsBlockFrame.cpp:998 #15 0x7fdcf2dafdb0 in nsBlockReflowContext::ReflowBlock(nsRect const&, bool, nsCollapsingMargin&, int, bool, nsLineBox*, nsHTMLReflowState&, unsigned int&, nsBlockReflowState&) layout/generic/nsBlockReflowContext.cpp:268 #16 0x7fdcf2d53101 in nsBlockFrame::ReflowBlockFrame(nsBlockReflowState&, nsLineList_iterator, bool*) layout/generic/nsBlockFrame.cpp:3090 #17 0x7fdcf2d47ee2 in nsBlockFrame::ReflowLine(nsBlockReflowState&, nsLineList_iterator, bool*) layout/generic/nsBlockFrame.cpp:2473 #18 0x7fdcf2d2f2e7 in nsBlockFrame::ReflowDirtyLines(nsBlockReflowState&) layout/generic/nsBlockFrame.cpp:1993 #19 0x7fdcf2d2259d in nsBlockFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&) layout/generic/nsBlockFrame.cpp:1045 #20 0x7fdcf2dafdb0 in nsBlockReflowContext::ReflowBlock(nsRect const&, bool, nsCollapsingMargin&, int, bool, nsLineBox*, nsHTMLReflowState&, unsigned int&, nsBlockReflowState&) layout/generic/nsBlockReflowContext.cpp:268 #21 0x7fdcf2d53101 in nsBlockFrame::ReflowBlockFrame(nsBlockReflowState&, nsLineList_iterator, bool*) layout/generic/nsBlockFrame.cpp:3090 #22 0x7fdcf2d47ee2 in nsBlockFrame::ReflowLine(nsBlockReflowState&, nsLineList_iterator, bool*) layout/generic/nsBlockFrame.cpp:2473 #23 0x7fdcf2d2f2e7 in nsBlockFrame::ReflowDirtyLines(nsBlockReflowState&) layout/generic/nsBlockFrame.cpp:1993 #24 0x7fdcf2d2259d in nsBlockFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&) layout/generic/nsBlockFrame.cpp:1045 Shadow byte and word: 0x1ffb991e7493: fd 0x1ffb991e7490: fd fd fd fd fd fd fd fd More shadow bytes: 0x1ffb991e7470: fa fa fa fa fa fa fa fa 0x1ffb991e7478: fa fa fa fa fa fa fa fa 0x1ffb991e7480: fa fa fa fa fa fa fa fa 0x1ffb991e7488: fa fa fa fa fa fa fa fa =>0x1ffb991e7490: fd fd fd fd fd fd fd fd 0x1ffb991e7498: fd fd fd fd fd fd fd fd 0x1ffb991e74a0: fd fd fd fd fd fd fd fd 0x1ffb991e74a8: fd fd fd fd fd fd fd fd 0x1ffb991e74b0: fd fd fd fd fd fd fd fd Stats: 252M malloced (278M for red zones) by 421919 calls Stats: 43M realloced by 24773 calls Stats: 228M freed by 300591 calls Stats: 96M really freed by 189262 calls Stats: 492M (126043 full pages) mmaped in 123 calls mmaps by size class: 8:294894; 9:32764; 10:12285; 11:14329; 12:3072; 13:1536; 14:1280; 15:256; 16:1152; 17:1280; 18:144; 19:40; 20:24; mallocs by size class: 8:351457; 9:34855; 10:9666; 11:16641; 12:2693; 13:1915; 14:1554; 15:317; 16:1289; 17:1310; 18:159; 19:41; 20:22; frees by size class: 8:246111; 9:26679; 10:6463; 11:13396; 12:1839; 13:1717; 14:1390; 15:267; 16:1233; 17:1294; 18:144; 19:39; 20:19; rfrees by size class: 8:165441; 9:9318; 10:2157; 11:8872; 12:662; 13:589; 14:588; 15:146; 16:1045; 17:414; 18:25; 19:4; 20:1; Stats: malloc large: 1532 small slow: 2354 ==6069== 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 Graphics: Text. Mozilla made it public on 23 October 2012 as CVE-2012-4216.
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.