Stack-buffer-overflow in nsCSSFrameConstructor::InterpretRubyWhitespace
Originally disclosed on Mozilla
- Fixed in 4 days
- Paid in 43 days
- Disclosed after 4 days
Created attachment 8577861 Testcase
Looks like another ruby issue, and also reproduces after fix from bug 1141919
================================================================= ==17310==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffe03c13e4 at pc 0x7f313c3c0cf6 bp 0x7fffe03c0d30 sp 0x7fffe03c0d28 READ of size 8 at 0x7fffe03c13e4 thread T0 (Web Content) #0 0x7f313c3c0cf5 in DoGetStyleDisplay /build/firefox/src/objdir-ff-asan/layout/base/../../dist/include/nsStyleStructList.h:144:1 #1 0x7f313c3c0cf5 in StyleDisplay /build/firefox/src/objdir-ff-asan/layout/base/../../dist/include/nsStyleStructList.h:144 #2 0x7f313c3c0cf5 in nsCSSFrameConstructor::InterpretRubyWhitespace(nsFrameConstructorState&, nsCSSFrameConstructor::FrameConstructionItemList::Iterator const&, nsCSSFrameConstructor::FrameConstructionItemList::Iterator const&) /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:9732 #3 0x7f313c3c051b in nsCSSFrameConstructor::WrapItemsInPseudoRubyLevelContainer(nsFrameConstructorState&, nsCSSFrameConstructor::FrameConstructionItemList::Iterator&, nsStyleContext*, nsIContent*) /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:9809:7 #4 0x7f313c3bec11 in nsCSSFrameConstructor::CreateNeededPseudoInternalRubyBoxes(nsFrameConstructorState&, nsCSSFrameConstructor::FrameConstructionItemList&, nsIFrame*) /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:9919:9 #5 0x7f313c2929ff in ConstructFramesFromItemList /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:10232:3 #6 0x7f313c2929ff in nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState&, nsIContent*, nsStyleContext*, nsContainerFrame*, bool, nsFrameItems&, bool, PendingBinding*, nsIFrame*) /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:10439 #7 0x7f313c2a6938 in nsCSSFrameConstructor::ConstructFrameFromItemInternal(nsCSSFrameConstructor::FrameConstructionItem&, nsFrameConstructorState&, nsContainerFrame*, nsFrameItems&) /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:3887:9 #8 0x7f313c2b0b95 in nsCSSFrameConstructor::ConstructFramesFromItem(nsFrameConstructorState&, nsCSSFrameConstructor::FrameConstructionItemList::Iterator&, nsContainerFrame*, nsFrameItems&) /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:5929:3 #9 0x7f313c2a6810 in ConstructFramesFromItemList /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:10239:5 #10 0x7f313c2a6810 in nsCSSFrameConstructor::ConstructFrameFromItemInternal(nsCSSFrameConstructor::FrameConstructionItem&, nsFrameConstructorState&, nsContainerFrame*, nsFrameItems&) /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:3883 #11 0x7f313c2b0b95 in nsCSSFrameConstructor::ConstructFramesFromItem(nsFrameConstructorState&, nsCSSFrameConstructor::FrameConstructionItemList::Iterator&, nsContainerFrame*, nsFrameItems&) /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:5929:3 #12 0x7f313c2a6810 in ConstructFramesFromItemList /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:10239:5 #13 0x7f313c2a6810 in nsCSSFrameConstructor::ConstructFrameFromItemInternal(nsCSSFrameConstructor::FrameConstructionItem&, nsFrameConstructorState&, nsContainerFrame*, nsFrameItems&) /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:3883 #14 0x7f313c2b0b95 in nsCSSFrameConstructor::ConstructFramesFromItem(nsFrameConstructorState&, nsCSSFrameConstructor::FrameConstructionItemList::Iterator&, nsContainerFrame*, nsFrameItems&) /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:5929:3 #15 0x7f313c292adc in ConstructFramesFromItemList /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:10239:5 #16 0x7f313c292adc in nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState&, nsIContent*, nsStyleContext*, nsContainerFrame*, bool, nsFrameItems&, bool, PendingBinding*, nsIFrame*) /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:10439 #17 0x7f313c2a6938 in nsCSSFrameConstructor::ConstructFrameFromItemInternal(nsCSSFrameConstructor::FrameConstructionItem&, nsFrameConstructorState&, nsContainerFrame*, nsFrameItems&) /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:3887:9 #18 0x7f313c2b0b95 in nsCSSFrameConstructor::ConstructFramesFromItem(nsFrameConstructorState&, nsCSSFrameConstructor::FrameConstructionItemList::Iterator&, nsContainerFrame*, nsFrameItems&) /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:5929:3 #19 0x7f313c2bd812 in ConstructFramesFromItemList /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:10239:5 #20 0x7f313c2bd812 in nsCSSFrameConstructor::ContentAppended(nsIContent*, nsIContent*, bool) /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:7249 #21 0x7f313c2b76dc in nsCSSFrameConstructor::CreateNeededFrames(nsIContent*) /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:6890:5 #22 0x7f313c2be8ca in nsCSSFrameConstructor::CreateNeededFrames() /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:6912:5 #23 0x7f313c230ebf in mozilla::RestyleManager::ProcessPendingRestyles() /build/firefox/src/layout/base/RestyleManager.cpp:1631:3 #24 0x7f313c454405 in PresShell::FlushPendingNotifications(mozilla::ChangesToFlush) /build/firefox/src/layout/base/nsPresShell.cpp:4280:9 #25 0x7f313c1c6747 in nsRefreshDriver::Tick(long, mozilla::TimeStamp) /build/firefox/src/layout/base/nsRefreshDriver.cpp:1599:11 #26 0x7f313c1cf383 in TickDriver /build/firefox/src/layout/base/nsRefreshDriver.cpp:198:5 #27 0x7f313c1cf383 in mozilla::RefreshDriverTimer::Tick(long, mozilla::TimeStamp) /build/firefox/src/layout/base/nsRefreshDriver.cpp:189 #28 0x7f313685c89f in nsTimerImpl::Fire() /build/firefox/src/xpcom/threads/nsTimerImpl.cpp:631:7 #29 0x7f313685d436 in nsTimerEvent::Run() /build/firefox/src/xpcom/threads/nsTimerImpl.cpp:724:3 #30 0x7f3136852b16 in nsThread::ProcessNextEvent(bool, bool*) /build/firefox/src/xpcom/threads/nsThread.cpp:855:7 #31 0x7f31368ac7f0 in NS_ProcessNextEvent(nsIThread*, bool) /build/firefox/src/xpcom/glue/nsThreadUtils.cpp:265:10 #32 0x7f31371345fe in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /build/firefox/src/ipc/glue/MessagePump.cpp:99:21 #33 0x7f31370e0fa1 in RunInternal /build/firefox/src/ipc/chromium/src/base/message_loop.cc:233:3 #34 0x7f31370e0fa1 in RunHandler /build/firefox/src/ipc/chromium/src/base/message_loop.cc:226 #35 0x7f31370e0fa1 in MessageLoop::Run() /build/firefox/src/ipc/chromium/src/base/message_loop.cc:200 #36 0x7f313bb72e1f in nsBaseAppShell::Run() /build/firefox/src/widget/nsBaseAppShell.cpp:164:3 #37 0x7f313d790b13 in XRE_RunAppShell /build/firefox/src/toolkit/xre/nsEmbedFunctions.cpp:743:12 #38 0x7f31370e0fa1 in RunInternal /build/firefox/src/ipc/chromium/src/base/message_loop.cc:233:3 #39 0x7f31370e0fa1 in RunHandler /build/firefox/src/ipc/chromium/src/base/message_loop.cc:226 #40 0x7f31370e0fa1 in MessageLoop::Run() /build/firefox/src/ipc/chromium/src/base/message_loop.cc:200 #41 0x7f313d78ff4c in XRE_InitChildProcess /build/firefox/src/toolkit/xre/nsEmbedFunctions.cpp:580:7 #42 0x4dc17e in content_process_main(int, char**) /build/firefox/src/ipc/app/../contentproc/plugin-container.cpp:211:19 #43 0x7f3133dc0ec4 in __libc_start_main #44 0x41c438 in _start
Address 0x7fffe03c13e4 is located in stack of thread T0 (Web Content) at offset 804 in frame #0 0x7f313c29175f in nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState&, nsIContent*, nsStyleContext*, nsContainerFrame*, bool, nsFrameItems&, bool, PendingBinding*, nsIFrame*) /build/firefox/src/layout/base/nsCSSFrameConstructor.cpp:10311
This frame has 15 object(s): [32, 56) 'iter.i' [96, 112) '.sroa.0.i4' [128, 144) '.sroa.0.i' [160, 164) 'namespaceID.i.i' [176, 200) 'floatSaveState.sroa.8' [240, 328) 'itemsToConstruct' [368, 480) 'anonymousItems' [512, 536) 'insertion' [576, 616) 'iter' [656, 680) 'ancestorPusher' [720, 736) 'parentTag' [752, 768) 'kidTag' [784, 800) 'params' <== Memory access at offset 804 overflows this variable [816, 832) '' <== Memory access at offset 804 underflows this variable [848, 856) '' HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext (longjmp and C++ exceptions are supported) Shadow bytes around the buggy address: 0x10007c070220: f2 f2 f2 f2 00 00 f2 f2 00 00 f2 f2 04 f2 00 00 0x10007c070230: 00 f2 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 00 0x10007c070240: 00 f2 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 00 0x10007c070250: 00 00 00 00 f2 f2 f2 f2 00 00 00 f2 f2 f2 f2 f2 0x10007c070260: 00 00 00 00 00 f2 f2 f2 f2 f2 00 00 00 f2 f2 f2 =>0x10007c070270: f2 f2 00 00 f2 f2 00 00 f2 f2 00 00[f2]f2 00 00 0x10007c070280: f2 f2 00 f3 f3 f3 f3 f3 00 00 00 00 00 00 00 00 0x10007c070290: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007c0702a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007c0702b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007c0702c0: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00 00 f2 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 ==17310==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 20 March 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.