Skip to content
Memory corruption Disclosed report

Heap-buffer-overflow WRITE in mozilla::gfx::TiledRegionImpl::AddRect

Abhishek Arya Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 49 days
  • Paid in 4 months
  • Disclosed after 49 days

Created attachment 8754186 Testcase

==19969==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f1937e57800 at pc 0x7f19596096d1 bp 0x7ffc2c78a8b0 sp 0x7ffc2c78a8a8 WRITE of size 8 at 0x7f1937e57800 thread T0 (Web Content) #0 0x7f19596096d0 in mozilla::gfx::TiledRegionImpl::AddRect(pixman_box32 const&)::$_0::operator()(nsTArray<pixman_box32>&, unsigned long&, mozilla::gfx::TileRange) const gfx/src/TiledRegion.cpp:291:26 #1 0x7f19595e53c8 in ProcessIntersectedTiles<(lambda at gfx/src/TiledRegion.cpp:284:5), (lambda at gfx/src/TiledRegion.cpp:295:5), nsTArray<pixman_box32> > gfx/src/TiledRegion.cpp:231:11 #2 0x7f19595e53c8 in mozilla::gfx::TiledRegionImpl::AddRect(pixman_box32 const&) gfx/src/TiledRegion.cpp:283 #3 0x7f1959887b53 in mozilla::gfx::TiledRegion<mozilla::gfx::IntRegionTypedmozilla::gfx::UnknownUnits >::Add(mozilla::gfx::IntRegionTypedmozilla::gfx::UnknownUnits const&) objdir-ff-asan/dist/include/mozilla/gfx/TiledRegion.h:122:12 #4 0x7f195987ad83 in mozilla::layers::BasicPaintedLayer::InvalidateRegion(mozilla::gfx::IntRegionTypedmozilla::gfx::UnknownUnits const&) gfx/layers/basic/BasicPaintedLayer.h:57:5 #5 0x7f195e2338f1 in InvalidatePostTransformRegion layout/base/FrameLayerBuilder.cpp:1746:3 #6 0x7f195e2338f1 in mozilla::FrameLayerBuilder::ComputeGeometryChangeForItem(mozilla::FrameLayerBuilder::DisplayItemData*) layout/base/FrameLayerBuilder.cpp:4427 #7 0x7f195e231eee in mozilla::FrameLayerBuilder::WillEndTransaction() layout/base/FrameLayerBuilder.cpp:1910:7 #8 0x7f195e258e8c in mozilla::FrameLayerBuilder::AddPaintedDisplayItem(mozilla::PaintedLayerData*, nsDisplayItem*, mozilla::DisplayItemClip const&, mozilla::ContainerState&, mozilla::LayerState, nsPoint const&) layout/base/FrameLayerBuilder.cpp:4523:7 #9 0x7f195e23dc35 in FinishPaintedLayerData<(lambda at layout/base/FrameLayerBuilder.cpp:2764:50)> layout/base/FrameLayerBuilder.cpp:3086:5 #10 0x7f195e23dc35 in mozilla::PaintedLayerDataNode::PopPaintedLayerData() layout/base/FrameLayerBuilder.cpp:2764 #11 0x7f195e23d1ac in PopAllPaintedLayerData layout/base/FrameLayerBuilder.cpp:2774:5 #12 0x7f195e23d1ac in mozilla::PaintedLayerDataNode::Finish(bool) layout/base/FrameLayerBuilder.cpp:2728 #13 0x7f195e23d565 in mozilla::PaintedLayerDataNode::FinishAllChildren(bool) layout/base/FrameLayerBuilder.cpp:2717:5 #14 0x7f195e25f56e in Finish layout/base/FrameLayerBuilder.cpp:2726:3 #15 0x7f195e25f56e in Finish layout/base/FrameLayerBuilder.cpp:2788 #16 0x7f195e25f56e in mozilla::ContainerState::Finish(unsigned int*, mozilla::gfx::IntRectTypedmozilla::gfx::UnknownUnits const&, nsDisplayList*, bool*) layout/base/FrameLayerBuilder.cpp:4926 #17 0x7f195e262c42 in mozilla::FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder*, mozilla::layers::LayerManager*, nsIFrame*, nsDisplayItem*, nsDisplayList*, mozilla::ContainerLayerParameters const&, mozilla::gfx::Matrix4x4Typed<mozilla::gfx::UnknownUnits, mozilla::gfx::UnknownUnits> const*, unsigned int) layout/base/FrameLayerBuilder.cpp:5340:5 #18 0x7f195e3afcf9 in nsDisplayList::PaintRoot(nsDisplayListBuilder*, nsRenderingContext*, unsigned int) layout/base/nsDisplayList.cpp:1757:33 #19 0x7f195e4753a6 in nsLayoutUtils::PaintFrame(nsRenderingContext*, nsIFrame*, nsRegion const&, unsigned int, nsDisplayListBuilderMode, nsLayoutUtils::PaintFrameFlags) layout/base/nsLayoutUtils.cpp:3585:5 #20 0x7f195e508b85 in PresShell::Paint(nsView*, nsRegion const&, unsigned int) layout/base/nsPresShell.cpp:6559:5 #21 0x7f195da8794a in nsViewManager::ProcessPendingUpdatesPaint(nsIWidget*) view/nsViewManager.cpp:482:7 #22 0x7f195da86631 in nsViewManager::ProcessPendingUpdatesForView(nsView*, bool) view/nsViewManager.cpp:413:9 #23 0x7f195da8a70b in nsViewManager::ProcessPendingUpdates() view/nsViewManager.cpp:1117:5 #24 0x7f195e1ed8ee in nsRefreshDriver::Tick(long, mozilla::TimeStamp) layout/base/nsRefreshDriver.cpp:1903:5 #25 0x7f195e1f865b in TickDriver layout/base/nsRefreshDriver.cpp:274:5 #26 0x7f195e1f865b in mozilla::RefreshDriverTimer::TickRefreshDrivers(long, mozilla::TimeStamp, nsTArray<RefPtr<nsRefreshDriver> >&) layout/base/nsRefreshDriver.cpp:246 #27 0x7f195e1f82b9 in mozilla::RefreshDriverTimer::Tick(long, mozilla::TimeStamp) layout/base/nsRefreshDriver.cpp:265:5 #28 0x7f195e1fa0a4 in mozilla::VsyncRefreshDriverTimer::RefreshDriverVsyncObserver::NotifyVsync(mozilla::TimeStamp) layout/base/nsRefreshDriver.cpp:425:9 #29 0x7f195ebc4d04 in mozilla::layout::VsyncChild::RecvNotify(mozilla::TimeStamp const&) layout/ipc/VsyncChild.cpp:64:5 #30 0x7f195871db2d in mozilla::layout::PVsyncChild::OnMessageReceived(IPC::Message const&) objdir-ff-asan/ipc/ipdl/PVsyncChild.cpp:233:20 #31 0x7f1958211ca2 in mozilla::ipc::PBackgroundChild::OnMessageReceived(IPC::Message const&) objdir-ff-asan/ipc/ipdl/PBackgroundChild.cpp:1890:16 #32 0x7f195814e442 in mozilla::ipc::MessageChannel::DispatchAsyncMessage(IPC::Message const&) ipc/glue/MessageChannel.cpp:1655:14 #33 0x7f195814a95d in mozilla::ipc::MessageChannel::DispatchMessage(IPC::Message const&) ipc/glue/MessageChannel.cpp:1593:17 #34 0x7f1958137087 in mozilla::ipc::MessageChannel::OnMaybeDequeueOne() ipc/glue/MessageChannel.cpp:1560:5 #35 0x7f195816a6d2 in applyImpl<mozilla::ipc::MessageChannel, bool (mozilla::ipc::MessageChannel::)()> objdir-ff-asan/dist/include/nsThreadUtils.h:707:12 #36 0x7f195816a6d2 in apply<mozilla::ipc::MessageChannel, bool (mozilla::ipc::MessageChannel::)()> objdir-ff-asan/dist/include/nsThreadUtils.h:713 #37 0x7f195816a6d2 in nsRunnableMethodImpl<bool (mozilla::ipc::MessageChannel::)(), false, true>::Run() objdir-ff-asan/dist/include/nsThreadUtils.h:741 #38 0x7f1958169c7f in Run objdir-ff-asan/dist/include/mozilla/ipc/MessageChannel.h:477:22 #39 0x7f1958169c7f in mozilla::ipc::MessageChannel::DequeueTask::Run() objdir-ff-asan/dist/include/mozilla/ipc/MessageChannel.h:496 #40 0x7f1957321e94 in nsThread::ProcessNextEvent(bool, bool) xpcom/threads/nsThread.cpp:1073:7 #41 0x7f19573a3db8 in NS_ProcessNextEvent(nsIThread*, bool) xpcom/glue/nsThreadUtils.cpp:290:10 #42 0x7f1958156d21 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) ipc/glue/MessagePump.cpp:98:21 #43 0x7f19580c4ae8 in RunInternal ipc/chromium/src/base/message_loop.cc:235:3 #44 0x7f19580c4ae8 in RunHandler ipc/chromium/src/base/message_loop.cc:228 #45 0x7f19580c4ae8 in MessageLoop::Run() ipc/chromium/src/base/message_loop.cc:208 #46 0x7f195daf683f in nsBaseAppShell::Run() widget/nsBaseAppShell.cpp:156:3 #47 0x7f195fca1927 in XRE_RunAppShell toolkit/xre/nsEmbedFunctions.cpp:809:12 #48 0x7f19580c4ae8 in RunInternal ipc/chromium/src/base/message_loop.cc:235:3 #49 0x7f19580c4ae8 in RunHandler ipc/chromium/src/base/message_loop.cc:228 #50 0x7f19580c4ae8 in MessageLoop::Run() ipc/chromium/src/base/message_loop.cc:208 #51 0x7f195fca0e88 in XRE_InitChildProcess toolkit/xre/nsEmbedFunctions.cpp:644:7 #52 0x4fd43e in content_process_main(int, char**) ipc/contentproc/plugin-container.cpp:231:19 #53 0x7f195448bec4 in __libc_start_main /build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:287 0x7f1937e57800 is located 0 bytes to the right of 46137344-byte region [0x7f1935257800,0x7f1937e57800) allocated by thread T0 (Web Content) here: #0 0x4c6488 in realloc asan_rtl #1 0x7f195714c1dd in Realloc objdir-ff-asan/dist/include/nsTArray.h:169:12 #2 0x7f195714c1dd in nsTArrayFallibleAllocator::ResultTypeProxy nsTArray_base<nsTArrayInfallibleAllocator, nsTArray_CopyWithMemutils>::EnsureCapacity<nsTArrayFallibleAllocator>(unsigned long, unsigned long) objdir-ff-asan/dist/include/nsTArray-inl.h:183 #3 0x7f1959609088 in InsertSlotsAt<nsTArrayFallibleAllocator> objdir-ff-asan/dist/include/nsTArray-inl.h:286:3 #4 0x7f1959609088 in InsertElementsAt<nsTArrayFallibleAllocator> objdir-ff-asan/dist/include/nsTArray.h:1828 #5 0x7f1959609088 in InsertElementsAt objdir-ff-asan/dist/include/nsTArray.h:1849 #6 0x7f1959609088 in mozilla::gfx::TiledRegionImpl::AddRect(pixman_box32 const&)::$_0::operator()(nsTArray<pixman_box32>&, unsigned long&, mozilla::gfx::TileRange) const gfx/src/TiledRegion.cpp:285 #7 0x7f19595e53c8 in ProcessIntersectedTiles<(lambda at gfx/src/TiledRegion.cpp:284:5), (lambda at gfx/src/TiledRegion.cpp:295:5), nsTArray<pixman_box32> > gfx/src/TiledRegion.cpp:231:11 #8 0x7f19595e53c8 in mozilla::gfx::TiledRegionImpl::AddRect(pixman_box32 const&) gfx/src/TiledRegion.cpp:283 #9 0x7f1959887b53 in mozilla::gfx::TiledRegion<mozilla::gfx::IntRegionTypedmozilla::gfx::UnknownUnits >::Add(mozilla::gfx::IntRegionTypedmozilla::gfx::UnknownUnits const&) objdir-ff-asan/dist/include/mozilla/gfx/TiledRegion.h:122:12 #10 0x7f195987ad83 in mozilla::layers::BasicPaintedLayer::InvalidateRegion(mozilla::gfx::IntRegionTypedmozilla::gfx::UnknownUnits const&) gfx/layers/basic/BasicPaintedLayer.h:57:5 #11 0x7f195e2338f1 in InvalidatePostTransformRegion layout/base/FrameLayerBuilder.cpp:1746:3 #12 0x7f195e2338f1 in mozilla::FrameLayerBuilder::ComputeGeometryChangeForItem(mozilla::FrameLayerBuilder::DisplayItemData*) layout/base/FrameLayerBuilder.cpp:4427 #13 0x7f195e231eee in mozilla::FrameLayerBuilder::WillEndTransaction() layout/base/FrameLayerBuilder.cpp:1910:7 #14 0x7f195e258e8c in mozilla::FrameLayerBuilder::AddPaintedDisplayItem(mozilla::PaintedLayerData*, nsDisplayItem*, mozilla::DisplayItemClip const&, mozilla::ContainerState&, mozilla::LayerState, nsPoint const&) layout/base/FrameLayerBuilder.cpp:4523:7 #15 0x7f195e23dc35 in FinishPaintedLayerData<(lambda at layout/base/FrameLayerBuilder.cpp:2764:50)> layout/base/FrameLayerBuilder.cpp:3086:5 #16 0x7f195e23dc35 in mozilla::PaintedLayerDataNode::PopPaintedLayerData() layout/base/FrameLayerBuilder.cpp:2764 #17 0x7f195e23d1ac in PopAllPaintedLayerData layout/base/FrameLayerBuilder.cpp:2774:5 #18 0x7f195e23d1ac in mozilla::PaintedLayerDataNode::Finish(bool) layout/base/FrameLayerBuilder.cpp:2728 #19 0x7f195e23d565 in mozilla::PaintedLayerDataNode::FinishAllChildren(bool) layout/base/FrameLayerBuilder.cpp:2717:5 #20 0x7f195e25f56e in Finish layout/base/FrameLayerBuilder.cpp:2726:3 #21 0x7f195e25f56e in Finish layout/base/FrameLayerBuilder.cpp:2788 #22 0x7f195e25f56e in mozilla::ContainerState::Finish(unsigned int*, mozilla::gfx::IntRectTypedmozilla::gfx::UnknownUnits const&, nsDisplayList*, bool*) layout/base/FrameLayerBuilder.cpp:4926 #23 0x7f195e262c42 in mozilla::FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder*, mozilla::layers::LayerManager*, nsIFrame*, nsDisplayItem*, nsDisplayList*, mozilla::ContainerLayerParameters const&, mozilla::gfx::Matrix4x4Typed<mozilla::gfx::UnknownUnits, mozilla::gfx::UnknownUnits> const*, unsigned int) layout/base/FrameLayerBuilder.cpp:5340:5 #24 0x7f195e3afcf9 in nsDisplayList::PaintRoot(nsDisplayListBuilder*, nsRenderingContext*, unsigned int) layout/base/nsDisplayList.cpp:1757:33 #25 0x7f195e4753a6 in nsLayoutUtils::PaintFrame(nsRenderingContext*, nsIFrame*, nsRegion const&, unsigned int, nsDisplayListBuilderMode, nsLayoutUtils::PaintFrameFlags) layout/base/nsLayoutUtils.cpp:3585:5 #26 0x7f195e508b85 in PresShell::Paint(nsView*, nsRegion const&, unsigned int) layout/base/nsPresShell.cpp:6559:5 #27 0x7f195da8794a in nsViewManager::ProcessPendingUpdatesPaint(nsIWidget*) view/nsViewManager.cpp:482:7 #28 0x7f195da86631 in nsViewManager::ProcessPendingUpdatesForView(nsView*, bool) view/nsViewManager.cpp:413:9 #29 0x7f195da8a70b in nsViewManager::ProcessPendingUpdates() view/nsViewManager.cpp:1117:5 #30 0x7f195e1ed8ee in nsRefreshDriver::Tick(long, mozilla::TimeStamp) layout/base/nsRefreshDriver.cpp:1903:5 #31 0x7f195e1f865b in TickDriver layout/base/nsRefreshDriver.cpp:274:5 #32 0x7f195e1f865b in mozilla::RefreshDriverTimer::TickRefreshDrivers(long, mozilla::TimeStamp, nsTArray<RefPtr<nsRefreshDriver> >&) layout/base/nsRefreshDriver.cpp:246 #33 0x7f195e1f82b9 in mozilla::RefreshDriverTimer::Tick(long, mozilla::TimeStamp) layout/base/nsRefreshDriver.cpp:265:5 #34 0x7f195e1fa0a4 in mozilla::VsyncRefreshDriverTimer::RefreshDriverVsyncObserver::NotifyVsync(mozilla::TimeStamp) layout/base/nsRefreshDriver.cpp:425:9 #35 0x7f195ebc4d04 in mozilla::layout::VsyncChild::RecvNotify(mozilla::TimeStamp const&) layout/ipc/VsyncChild.cpp:64:5 #36 0x7f195871db2d in mozilla::layout::PVsyncChild::OnMessageReceived(IPC::Message const&) objdir-ff-asan/ipc/ipdl/PVsyncChild.cpp:233:20 #37 0x7f1958211ca2 in mozilla::ipc::PBackgroundChild::OnMessageReceived(IPC::Message const&) objdir-ff-asan/ipc/ipdl/PBackgroundChild.cpp:1890:16 #38 0x7f195814e442 in mozilla::ipc::MessageChannel::DispatchAsyncMessage(IPC::Message const&) ipc/glue/MessageChannel.cpp:1655:14 #39 0x7f195814a95d in mozilla::ipc::MessageChannel::DispatchMessage(IPC::Message const&) ipc/glue/MessageChannel.cpp:1593:17 #40 0x7f1958137087 in mozilla::ipc::MessageChannel::OnMaybeDequeueOne() ipc/glue/MessageChannel.cpp:1560:5

SUMMARY: AddressSanitizer: heap-buffer-overflow (/mnt/scratch0/clusterfuzz/slave-bot/builds/linux_asan_firefox/custom/firefox/libxul.so+0x41a76d0) Shadow bytes around the buggy address: 0x0fe3a6fc2eb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0fe3a6fc2ec0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0fe3a6fc2ed0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0fe3a6fc2ee0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0fe3a6fc2ef0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0fe3a6fc2f00:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0fe3a6fc2f10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0fe3a6fc2f20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0fe3a6fc2f30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0fe3a6fc2f40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0fe3a6fc2f50: 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 ==19969==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 Graphics. Mozilla made it public on 7 July 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.

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.