Heap-use-after-free in nsFrame::DidSetStyleContext
Originally disclosed on Mozilla
- Fixed in 20 days
- Paid in 6 months
- Disclosed after 20 days
Created attachment 8630311 test.html
==7493==ERROR: AddressSanitizer: heap-use-after-free on address 0x608000000028 at pc 0x7f3f5ceeea8a bp 0x7fffa54df280 sp 0x7fffa54df278 READ of size 1 at 0x608000000028 thread T0 (Web Content) #0 0x7f3f5ceeea89 in nsFrame::DidSetStyleContext(nsStyleContext*) layout/style/nsStyleStruct.h:627:9 #1 0x7f3f5cb7c39a in mozilla::RestyleManager::ReparentStyleContext(nsIFrame*) layout/generic/nsIFrame.h:543:7 #2 0x7f3f5cff157a in nsFirstLineFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&) layout/generic/nsInlineFrame.cpp:364:5 #3 0x7f3f5ce01b86 in nsLineLayout::ReflowFrame(nsIFrame*, unsigned int&, nsHTMLReflowMetrics*, bool&) layout/generic/nsLineLayout.cpp:956:5 #4 0x7f3f5ce6f000 in nsBlockFrame::ReflowInlineFrame(nsBlockReflowState&, nsLineLayout&, nsLineList_iterator, nsIFrame*, LineReflowStatus*) layout/generic/nsBlockFrame.cpp:3937:3 #5 0x7f3f5ce6d4a2 in nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState&, nsLineLayout&, nsLineList_iterator, nsFlowAreaRect&, int&, nsFloatManager::SavedState*, bool*, LineReflowStatus*, bool) layout/generic/nsBlockFrame.cpp:3739:5 #6 0x7f3f5ce644e6 in nsBlockFrame::ReflowInlineFrames(nsBlockReflowState&, nsLineList_iterator, bool*) layout/generic/nsBlockFrame.cpp:3605:9 #7 0x7f3f5ce54908 in nsBlockFrame::ReflowDirtyLines(nsBlockReflowState&) layout/generic/nsBlockFrame.cpp:2712:5 #8 0x7f3f5ce4db07 in nsBlockFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&) layout/generic/nsBlockFrame.cpp:1160:3 #9 0x7f3f5ce6a9ea in nsBlockReflowContext::ReflowBlock(mozilla::LogicalRect const&, bool, nsCollapsingMargin&, int, bool, nsLineBox*, nsHTMLReflowState&, unsigned int&, nsBlockReflowState&) layout/generic/nsBlockReflowContext.cpp:297:3 #10 0x7f3f5ce6128f in nsBlockFrame::ReflowBlockFrame(nsBlockReflowState&, nsLineList_iterator, bool*) layout/generic/nsBlockFrame.cpp:3332:5 #11 0x7f3f5ce548a3 in nsBlockFrame::ReflowDirtyLines(nsBlockReflowState&) layout/generic/nsBlockFrame.cpp:2709:5 #12 0x7f3f5ce4db07 in nsBlockFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&) layout/generic/nsBlockFrame.cpp:1160:3 #13 0x7f3f5ce6a9ea in nsBlockReflowContext::ReflowBlock(mozilla::LogicalRect const&, bool, nsCollapsingMargin&, int, bool, nsLineBox*, nsHTMLReflowState&, unsigned int&, nsBlockReflowState&) layout/generic/nsBlockReflowContext.cpp:297:3 #14 0x7f3f5ce6128f in nsBlockFrame::ReflowBlockFrame(nsBlockReflowState&, nsLineList_iterator, bool*) layout/generic/nsBlockFrame.cpp:3332:5 #15 0x7f3f5ce548a3 in nsBlockFrame::ReflowDirtyLines(nsBlockReflowState&) layout/generic/nsBlockFrame.cpp:2709:5 #16 0x7f3f5ce4db07 in nsBlockFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&) layout/generic/nsBlockFrame.cpp:1160:3 #17 0x7f3f5ce6a9ea in nsBlockReflowContext::ReflowBlock(mozilla::LogicalRect const&, bool, nsCollapsingMargin&, int, bool, nsLineBox*, nsHTMLReflowState&, unsigned int&, nsBlockReflowState&) layout/generic/nsBlockReflowContext.cpp:297:3 #18 0x7f3f5ce6128f in nsBlockFrame::ReflowBlockFrame(nsBlockReflowState&, nsLineList_iterator, bool*) layout/generic/nsBlockFrame.cpp:3332:5 #19 0x7f3f5ce548a3 in nsBlockFrame::ReflowDirtyLines(nsBlockReflowState&) layout/generic/nsBlockFrame.cpp:2709:5 #20 0x7f3f5ce4db07 in nsBlockFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&) layout/generic/nsBlockFrame.cpp:1160:3 #21 0x7f3f5ceb9758 in nsContainerFrame::ReflowChild(nsIFrame*, nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, mozilla::WritingMode const&, mozilla::LogicalPoint const&, int, unsigned int, unsigned int&, nsOverflowContinuationTracker*) layout/generic/nsContainerFrame.cpp:976:3 #22 0x7f3f5ce9da29 in nsCanvasFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&) layout/generic/nsCanvasFrame.cpp:676:5 #23 0x7f3f5cf4f676 in nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowState*, bool, bool, nsHTMLReflowMetrics*, bool) layout/generic/nsContainerFrame.cpp:976:3 #24 0x7f3f5cf510d9 in nsHTMLScrollFrame::ReflowContents(ScrollReflowState*, nsHTMLReflowMetrics const&) layout/generic/nsGfxScrollFrame.cpp:631:3 #25 0x7f3f5cf535bb in nsHTMLScrollFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&) layout/generic/nsGfxScrollFrame.cpp:866:3 #26 0x7f3f5ceb9b54 in nsContainerFrame::ReflowChild(nsIFrame*, nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, int, int, unsigned int, unsigned int&, nsOverflowContinuationTracker*) layout/generic/nsContainerFrame.cpp:1018:3 #27 0x7f3f5d0ba61c in ViewportFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&) layout/generic/nsViewportFrame.cpp:217:7 #28 0x7f3f5cda41df in PresShell::DoReflow(nsIFrame*, bool) layout/base/nsPresShell.cpp:9030:3 #29 0x7f3f5cdb985f in PresShell::ProcessReflowCommands(bool) layout/base/nsPresShell.cpp:9189:24 #30 0x7f3f5cdb89b5 in PresShell::FlushPendingNotifications(mozilla::ChangesToFlush) layout/base/nsPresShell.cpp:4092:11 #31 0x7f3f5caf9920 in nsRefreshDriver::Tick(long, mozilla::TimeStamp) layout/base/nsRefreshDriver.cpp:1731:11 #32 0x7f3f5cb0465a in mozilla::RefreshDriverTimer::Tick(long, mozilla::TimeStamp) layout/base/nsRefreshDriver.cpp:195:5 #33 0x7f3f5cb064e4 in mozilla::VsyncRefreshDriverTimer::RefreshDriverVsyncObserver::NotifyVsync(mozilla::TimeStamp) layout/base/nsRefreshDriver.cpp:437:5 #34 0x7f3f5d3e9564 in mozilla::layout::VsyncChild::RecvNotify(mozilla::TimeStamp const&) layout/ipc/VsyncChild.cpp:63:5 #35 0x7f3f578c6e5b in mozilla::layout::PVsyncChild::OnMessageReceived(IPC::Message const&) objdir-ff-asan/ipc/ipdl/PVsyncChild.cpp:220:20 #36 0x7f3f5741d6f7 in mozilla::ipc::PBackgroundChild::OnMessageReceived(IPC::Message const&) objdir-ff-asan/ipc/ipdl/PBackgroundChild.cpp:1236:16 #37 0x7f3f573a118b in mozilla::ipc::MessageChannel::DispatchAsyncMessage(IPC::Message const&) ipc/glue/MessageChannel.cpp:1279:14 #38 0x7f3f5739e64a in mozilla::ipc::MessageChannel::DispatchMessage(IPC::Message const&) ipc/glue/MessageChannel.cpp:1198:9 #39 0x7f3f573911d0 in mozilla::ipc::MessageChannel::OnMaybeDequeueOne() ipc/glue/MessageChannel.cpp:1182:9 #40 0x7f3f57333e3d in MessageLoop::DeferOrRunPendingTask(MessageLoop::PendingTask const&) ipc/chromium/src/base/message_loop.cc:364:3 #41 0x7f3f57334b0a in MessageLoop::DoWork() ipc/chromium/src/base/message_loop.cc:459:13 #42 0x7f3f573a8792 in mozilla::ipc::DoWorkRunnable::Run() ipc/glue/MessagePump.cpp:220:3 #43 0x7f3f56a80a06 in nsThread::ProcessNextEvent(bool, bool*) xpcom/threads/nsThread.cpp:848:7 #44 0x7f3f56af964c in NS_ProcessNextEvent(nsIThread*, bool) xpcom/glue/nsThreadUtils.cpp:265:10 #45 0x7f3f573a7f3e in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) ipc/glue/MessagePump.cpp:95:21 #46 0x7f3f57332aa1 in MessageLoop::Run() ipc/chromium/src/base/message_loop.cc:234:3 #47 0x7f3f5c45154f in nsBaseAppShell::Run() widget/nsBaseAppShell.cpp:165:3 #48 0x7f3f5e394943 in XRE_RunAppShell toolkit/xre/nsEmbedFunctions.cpp:778:12 #49 0x7f3f57332aa1 in MessageLoop::Run() ipc/chromium/src/base/message_loop.cc:234:3 #50 0x7f3f5e393e67 in XRE_InitChildProcess toolkit/xre/nsEmbedFunctions.cpp:614:7 #51 0x4dbbb2 in content_process_main(int, char**) ipc/contentproc/plugin-container.cpp:236:19 #52 0x7f3f53e63ec4 in __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287 0x608000000028 is located 8 bytes inside of 96-byte region [0x608000000020,0x608000000080) freed by thread T0 (Web Content) here: #0 0x4b6690 in realloc asan_rtl #1 0x7f3f56949aa9 in nsACString_internal::MutatePrep(unsigned int, char**, unsigned int*) xpcom/string/nsSubstring.cpp:246:27 #2 0x7f3f56953847 in nsACString_internal::ReplacePrepInternal(unsigned int, unsigned int, unsigned int, unsigned int) xpcom/string/nsTSubstring.cpp:169:8 #3 0x7f3f56955fc0 in nsACString_internal::Replace(unsigned int, unsigned int, char) xpcom/string/nsTSubstring.h:1010:12 #4 0x7f3f569e70cf in nsLocalFile::AppendRelativeNativePath(nsACString_internal const&) objdir-ff-asan/dist/include/nsTSubstring.h:524:5 #5 0x7f3f56abe7b8 in mozilla::FileLocation::FileLocation(mozilla::FileLocation const&, char const*) xpcom/build/FileLocation.cpp:69:7 #6 0x7f3f56a5260a in nsComponentManagerImpl::ManifestBinaryComponent(nsComponentManagerImpl::ManifestProcessingContext&, int, char* const*) xpcom/components/nsComponentManager.cpp:675:16 #7 0x7f3f56a6132c in ParseManifest(NSLocationType, mozilla::FileLocation&, char*, bool, bool) xpcom/components/ManifestParser.cpp:807:9 #8 0x7f3f56a520e6 in nsComponentManagerImpl::RegisterManifest(NSLocationType, mozilla::FileLocation&, bool) xpcom/components/nsComponentManager.cpp:638:5 #9 0x7f3f56a52463 in nsComponentManagerImpl::ManifestManifest(nsComponentManagerImpl::ManifestProcessingContext&, int, char* const*) xpcom/components/nsComponentManager.cpp:660:3 #10 0x7f3f56a6132c in ParseManifest(NSLocationType, mozilla::FileLocation&, char*, bool, bool) xpcom/components/ManifestParser.cpp:807:9 #11 0x7f3f56a520e6 in nsComponentManagerImpl::RegisterManifest(NSLocationType, mozilla::FileLocation&, bool) xpcom/components/nsComponentManager.cpp:638:5 #12 0x7f3f56a4fbe4 in nsComponentManagerImpl::Init() xpcom/components/nsComponentManager.cpp:846:5 #13 0x7f3f56acef3e in NS_InitXPCOM2 xpcom/build/XPCOMInit.cpp:698:8 #14 0x7f3f5e393388 in XRE_InitEmbedding2 toolkit/xre/nsEmbedFunctions.cpp:172:8 #15 0x7f3f573ab366 in mozilla::ipc::ScopedXREEmbed::Start() ipc/glue/ScopedXREEmbed.cpp:104:10 #16 0x7f3f5be3dc0e in mozilla::dom::ContentProcess::Init() dom/ipc/ContentProcess.cpp:81:5 #17 0x7f3f5e393e5b in XRE_InitChildProcess toolkit/xre/nsEmbedFunctions.cpp:601:12 #18 0x4dbbb2 in content_process_main(int, char**) ipc/contentproc/plugin-container.cpp:236:19 #19 0x7f3f53e63ec4 in __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287
previously allocated by thread T0 (Web Content) here: #0 0x4b62f8 in __interceptor_malloc asan_rtl #1 0x7f3f569499ba in nsACString_internal::MutatePrep(unsigned int, char**, unsigned int*) xpcom/string/nsSubstring.cpp:217:22 #2 0x7f3f56953847 in nsACString_internal::ReplacePrepInternal(unsigned int, unsigned int, unsigned int, unsigned int) xpcom/string/nsTSubstring.cpp:169:8 #3 0x7f3f569542ba in nsACString_internal::Assign(char const*, unsigned int, mozilla::fallible_t const&) xpcom/string/nsTSubstring.h:1010:12 #4 0x7f3f569548a9 in nsACString_internal::Assign(nsACString_internal const&, mozilla::fallible_t const&) xpcom/string/nsTSubstring.cpp:408:10 #5 0x7f3f56936a24 in nsACString_internal::Assign(nsACString_internal const&) xpcom/string/nsTSubstring.cpp:364:8 #6 0x7f3f569e5f99 in nsLocalFile::InitWithNativePath(nsACString_internal const&) objdir-ff-asan/dist/include/nsTString.h:98:5 #7 0x7f3f569f0254 in NS_NewNativeLocalFile xpcom/io/nsLocalFileUnix.cpp:2070:19 #8 0x7f3f569e8346 in nsLocalFile::GetParent(nsIFile**) xpcom/io/nsLocalFileUnix.cpp:1473:17 #9 0x7f3f56abe6f6 in mozilla::FileLocation::FileLocation(mozilla::FileLocation const&, char const*) xpcom/build/FileLocation.cpp:56:7 #10 0x7f3f56a5260a in nsComponentManagerImpl::ManifestBinaryComponent(nsComponentManagerImpl::ManifestProcessingContext&, int, char* const*) xpcom/components/nsComponentManager.cpp:675:16 #11 0x7f3f56a6132c in ParseManifest(NSLocationType, mozilla::FileLocation&, char*, bool, bool) xpcom/components/ManifestParser.cpp:807:9 #12 0x7f3f56a520e6 in nsComponentManagerImpl::RegisterManifest(NSLocationType, mozilla::FileLocation&, bool) xpcom/components/nsComponentManager.cpp:638:5 #13 0x7f3f56a52463 in nsComponentManagerImpl::ManifestManifest(nsComponentManagerImpl::ManifestProcessingContext&, int, char* const*) xpcom/components/nsComponentManager.cpp:660:3 #14 0x7f3f56a6132c in ParseManifest(NSLocationType, mozilla::FileLocation&, char*, bool, bool) xpcom/components/ManifestParser.cpp:807:9 #15 0x7f3f56a520e6 in nsComponentManagerImpl::RegisterManifest(NSLocationType, mozilla::FileLocation&, bool) xpcom/components/nsComponentManager.cpp:638:5 #16 0x7f3f56a4fbe4 in nsComponentManagerImpl::Init() xpcom/components/nsComponentManager.cpp:846:5 #17 0x7f3f56acef3e in NS_InitXPCOM2 xpcom/build/XPCOMInit.cpp:698:8 #18 0x7f3f5e393388 in XRE_InitEmbedding2 toolkit/xre/nsEmbedFunctions.cpp:172:8 #19 0x7f3f573ab366 in mozilla::ipc::ScopedXREEmbed::Start() ipc/glue/ScopedXREEmbed.cpp:104:10 #20 0x7f3f5be3dc0e in mozilla::dom::ContentProcess::Init() dom/ipc/ContentProcess.cpp:81:5 #21 0x7f3f5e393e5b in XRE_InitChildProcess toolkit/xre/nsEmbedFunctions.cpp:601:12 #22 0x4dbbb2 in content_process_main(int, char**) ipc/contentproc/plugin-container.cpp:236:19 #23 0x7f3f53e63ec4 in __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287
Shadow bytes around the buggy address: 0x0c107fff7fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c107fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c107fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c107fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c107fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c107fff8000: fa fa fa fa fd[fd]fd fd fd fd fd fd fd fd fd fd 0x0c107fff8010: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa 0x0c107fff8020: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fd 0x0c107fff8030: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa 0x0c107fff8040: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 01 0x0c107fff8050: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 01 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 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 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==7493==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 high-severity memory corruption bug in CSS Parsing and Computation. Mozilla made it public on 27 July 2015.
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.