Heap-buffer-overflow & crash in nsIFrame::GetUsedMargin (or in debug build: "Assertion failure: mMargin.ConvertsToLength(), at layout/style/nsStyleStruct.h:839")
Originally disclosed on Mozilla
- Fixed in 9 days
- Paid in 22 days
- Disclosed after 9 days
Created attachment 8752600 testcase 1 (margin.html)
==8392==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60d000000000 at pc 0x7f2dddd1ccf6 bp 0x7ffef05c2420 sp 0x7ffef05c2418 READ of size 4 at 0x60d000000000 thread T0 (Web Content) #0 0x7f2dddd1ccf5 in ToLength objdir-ff-asan/dist/include/nsStyleCoord.h:96:14 #1 0x7f2dddd1ccf5 in ToLength objdir-ff-asan/dist/include/nsStyleCoord.h:193 #2 0x7f2dddd1ccf5 in ToLength objdir-ff-asan/dist/include/nsStyleCoord.h:317 #3 0x7f2dddd1ccf5 in GetMarginNoPercentage layout/style/nsStyleStruct.h:841 #4 0x7f2dddd1ccf5 in nsIFrame::GetUsedMargin() const layout/generic/nsFrame.cpp:969 #5 0x7f2dddc3f72a in nsIFrame::GetLogicalUsedMargin(mozilla::WritingMode) const layout/generic/nsIFrame.h:967:49 #6 0x7f2ddd9b2bf5 in nsBidiPresUtils::RepositionFrame(nsIFrame*, bool, int, nsTHashtable<nsFrameContinuationState> const*, mozilla::WritingMode, bool, nsSize const&) layout/base/nsBidiPresUtils.cpp:1568:31 #7 0x7f2ddd9ae5bf in nsBidiPresUtils::RepositionInlineFrames(BidiLineData*, mozilla::WritingMode, nsSize const&, int) layout/base/nsBidiPresUtils.cpp:1691:14 #8 0x7f2ddd9ad7b3 in nsBidiPresUtils::ReorderFrames(nsIFrame*, int, mozilla::WritingMode, nsSize const&, int) layout/base/nsBidiPresUtils.cpp:1276:10 #9 0x7f2dddc2d085 in nsLineLayout::TextAlignLine(nsLineBox*, bool) layout/generic/nsLineLayout.cpp:3239:5 #10 0x7f2dddc93a17 in nsBlockFrame::PlaceLine(nsBlockReflowState&, nsLineLayout&, nsLineList_iterator, nsFloatManager::SavedState*, mozilla::LogicalRect&, int&, bool*) layout/generic/nsBlockFrame.cpp:4507:3 #11 0x7f2dddc91a3b in nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState&, nsLineLayout&, nsLineList_iterator, nsFlowAreaRect&, int&, nsFloatManager::SavedState*, bool*, LineReflowStatus*, bool) layout/generic/nsBlockFrame.cpp:4016:12 #12 0x7f2dddc875ae in nsBlockFrame::ReflowInlineFrames(nsBlockReflowState&, nsLineList_iterator, bool*) layout/generic/nsBlockFrame.cpp:3755:9 #13 0x7f2dddc77547 in ReflowLine layout/generic/nsBlockFrame.cpp:2753:5 #14 0x7f2dddc77547 in nsBlockFrame::ReflowDirtyLines(nsBlockReflowState&) layout/generic/nsBlockFrame.cpp:2289 #15 0x7f2dddc701c3 in nsBlockFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&) layout/generic/nsBlockFrame.cpp:1189:3 #16 0x7f2dddc8e164 in nsBlockReflowContext::ReflowBlock(mozilla::LogicalRect const&, bool, nsCollapsingMargin&, int, bool, nsLineBox*, nsHTMLReflowState&, unsigned int&, nsBlockReflowState&) layout/generic/nsBlockReflowContext.cpp:306:3 #17 0x7f2dddc83c6a in nsBlockFrame::ReflowBlockFrame(nsBlockReflowState&, nsLineList_iterator, bool*) layout/generic/nsBlockFrame.cpp:3391:7 #18 0x7f2dddc77560 in ReflowLine layout/generic/nsBlockFrame.cpp:2750:5 #19 0x7f2dddc77560 in nsBlockFrame::ReflowDirtyLines(nsBlockReflowState&) layout/generic/nsBlockFrame.cpp:2289 #20 0x7f2dddc701c3 in nsBlockFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&) layout/generic/nsBlockFrame.cpp:1189:3 #21 0x7f2dddcd0cac in ReflowChild layout/generic/nsContainerFrame.cpp:1022:3 #22 0x7f2dddcd0cac in nsCanvasFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&) layout/generic/nsCanvasFrame.cpp:644 #23 0x7f2dddd7ea7d in ReflowChild layout/generic/nsContainerFrame.cpp:1022:3 #24 0x7f2dddd7ea7d in nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowState*, bool, bool, nsHTMLReflowMetrics*, bool) layout/generic/nsGfxScrollFrame.cpp:541 #25 0x7f2dddd8031a in nsHTMLScrollFrame::ReflowContents(ScrollReflowState*, nsHTMLReflowMetrics const&) layout/generic/nsGfxScrollFrame.cpp:653:3 #26 0x7f2dddd8277b in nsHTMLScrollFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&) layout/generic/nsGfxScrollFrame.cpp:887:3 #27 0x7f2dddce96ad in nsContainerFrame::ReflowChild(nsIFrame*, nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, int, int, unsigned int, unsigned int&, nsOverflowContinuationTracker*) layout/generic/nsContainerFrame.cpp:1065:3 #28 0x7f2dddf40377 in ViewportFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&) layout/generic/nsViewportFrame.cpp:313:7 #29 0x7f2dddbaf31d in PresShell::DoReflow(nsIFrame*, bool) layout/base/nsPresShell.cpp:9514:3 #30 0x7f2dddbc335d in PresShell::ProcessReflowCommands(bool) layout/base/nsPresShell.cpp:9687:24 #31 0x7f2dddbc224e in PresShell::FlushPendingNotifications(mozilla::ChangesToFlush) layout/base/nsPresShell.cpp:4103:11 #32 0x7f2dddafed8c in nsDocumentViewer::LoadComplete(nsresult) layout/base/nsDocumentViewer.cpp:928:5 #33 0x7f2dde8f9bfc in nsDocShell::EndPageLoad(nsIWebProgress*, nsIChannel*, nsresult) docshell/base/nsDocShell.cpp:7517:5 #34 0x7f2dde8f5edf in nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) docshell/base/nsDocShell.cpp:7331:7 #35 0x7f2dde8fce6f in non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) docshell/base/nsDocShell.cpp:7228:13 #36 0x7f2dd895e71a in nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, nsresult) uriloader/base/nsDocLoader.cpp:1250:3 #37 0x7f2dd895d355 in nsDocLoader::doStopDocumentLoad(nsIRequest*, nsresult) uriloader/base/nsDocLoader.cpp:834:5 #38 0x7f2dd8959eac in nsDocLoader::DocLoaderIsEmpty(bool) uriloader/base/nsDocLoader.cpp:724:9 #39 0x7f2dd895bfa5 in nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, nsresult) uriloader/base/nsDocLoader.cpp:608:5 #40 0x7f2dd895cf5c in non-virtual thunk to nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, nsresult) uriloader/base/nsDocLoader.cpp:464:14 #41 0x7f2dd6be7069 in nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, nsresult) netwerk/base/nsLoadGroup.cpp:633:18 #42 0x7f2dd986a073 in nsDocument::DoUnblockOnload() dom/base/nsDocument.cpp:9192:7 #43 0x7f2dd9869a21 in nsDocument::UnblockOnload(bool) dom/base/nsDocument.cpp:9120:9 #44 0x7f2dd983943c in nsDocument::DispatchContentLoadedEvents() dom/base/nsDocument.cpp:5270:3 #45 0x7f2dd990fd42 in applyImpl<nsDocument, void (nsDocument::)()> objdir-ff-asan/dist/include/nsThreadUtils.h:707:12 #46 0x7f2dd990fd42 in apply<nsDocument, void (nsDocument::)()> objdir-ff-asan/dist/include/nsThreadUtils.h:713 #47 0x7f2dd990fd42 in nsRunnableMethodImpl<void (nsDocument::)(), true, false>::Run() objdir-ff-asan/dist/include/nsThreadUtils.h:741 #48 0x7f2dd6a02554 in nsThread::ProcessNextEvent(bool, bool) xpcom/threads/nsThread.cpp:1073:7 #49 0x7f2dd6a84478 in NS_ProcessNextEvent(nsIThread*, bool) xpcom/glue/nsThreadUtils.cpp:290:10 #50 0x7f2dd78343a1 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) ipc/glue/MessagePump.cpp:98:21 #51 0x7f2dd77a4ea8 in RunInternal ipc/chromium/src/base/message_loop.cc:233:3 #52 0x7f2dd77a4ea8 in RunHandler ipc/chromium/src/base/message_loop.cc:226 #53 0x7f2dd77a4ea8 in MessageLoop::Run() ipc/chromium/src/base/message_loop.cc:206 #54 0x7f2ddd1c9f9f in nsBaseAppShell::Run() widget/nsBaseAppShell.cpp:156:3 #55 0x7f2ddf372077 in XRE_RunAppShell toolkit/xre/nsEmbedFunctions.cpp:802:12 #56 0x7f2dd77a4ea8 in RunInternal ipc/chromium/src/base/message_loop.cc:233:3 #57 0x7f2dd77a4ea8 in RunHandler ipc/chromium/src/base/message_loop.cc:226 #58 0x7f2dd77a4ea8 in MessageLoop::Run() ipc/chromium/src/base/message_loop.cc:206 #59 0x7f2ddf3716e0 in XRE_InitChildProcess toolkit/xre/nsEmbedFunctions.cpp:637:7 #60 0x4fcfdb in content_process_main(int, char**) ipc/contentproc/plugin-container.cpp:237:19 #61 0x7f2dd3b71ec4 in __libc_start_main /build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:287 AddressSanitizer can not describe address in more detail (wild memory access suspected). SUMMARY: AddressSanitizer: heap-buffer-overflow (/mnt/scratch0/clusterfuzz/slave-bot/builds/linux_asan_firefox/custom/firefox/libxul.so+0x91d4cf5) Shadow bytes around the buggy address: 0x0c1a7fff7fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c1a7fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c1a7fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c1a7fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c1a7fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c1a7fff8000:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1a7fff8010: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1a7fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1a7fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1a7fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1a7fff8050: fa fa fa fa fa fa fa fa 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 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 ==8392==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 Layout. Mozilla made it public on 24 May 2016.
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.