Skip to content
Memory corruption Disclosed report Advanced CVE-2024-9936

High Address SEGV in SelectionNodeCache::MaybeCollect() from PaintTextWithSelection

Atte Kettunen Follow

Originally disclosed on Mozilla

  • Fixed in 9 days
  • Paid in 16 days
  • Disclosed after 9 days
Text
Created attachment 9426373
SEGV-nown-operator-HasChildren-NextNode-mozillaContentIteratorBasensINodeNext.html

Tested on:

OS: Ubuntu 22.04
Firefox: fuzzfetch fetched:
Identified task: https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.v2.mozilla-central.latest.firefox.linux64-asan-opt
> Task ID: fL6HkB9ZRQ2U2MIiBJx_ag
> Rank: 1726996556
> Changeset: f51fed24a523285f52651d636da8782050b1c8e7
> Build ID: 20240922091556

Debug build reports:
[1336886] Hit MOZ_CRASH(assertion failed: distance_to_stack_bottom <= max_allowable_distance) at servo/components/style/context.rs:609

ASAN-output snippet (from release ASAN-build):
==1326486==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x7fffe1a83e80 bp 0x7fffffff5af0 sp 0x7fffffff5ae0 T0)
==1326486==The signal is caused by a READ memory access.
==1326486==Hint: this fault was caused by a dereference of a high value address (see register values below).  Disassemble the provided pc to learn which register was used.
    #0 0x7fffe1a83e80 in operator bool /builds/worker/workspace/obj-build/dist/include/nsCOMPtr.h:767:45
    #1 0x7fffe1a83e80 in HasChildren /builds/worker/checkouts/gecko/dom/base/nsINode.h:672:39
    #2 0x7fffe1a83e80 in NextNode /builds/worker/checkouts/gecko/dom/base/ContentIterator.cpp:694:15
    #3 0x7fffe1a83e80 in mozilla::ContentIteratorBase<nsINode*>::Next() /builds/worker/checkouts/gecko/dom/base/ContentIterator.cpp:798:14
    #4 0x7fffe1d3e419 in operator() /builds/worker/checkouts/gecko/dom/base/Selection.cpp:343:35
    #5 0x7fffe1d3e419 in OrInsertWith<(lambda at /builds/worker/checkouts/gecko/dom/base/Selection.cpp:329:56)> /builds/worker/checkouts/gecko/xpcom/ds/nsBaseHashtable.h:726:23
    #6 0x7fffe1d3e419 in operator()<nsBaseHashtable<nsPtrHashKey<const mozilla::dom::Selection>, nsTBaseHashSet<nsPtrHashKey<const nsINode> >, nsTBaseHashSet<nsPtrHashKey<const nsINode> >, nsDefaultConverter<nsTBaseHashSet<nsPtrHashKey<const nsINode> >, nsTBaseHashSet<nsPtrHashKey<const nsINode> > > >::EntryHandle> /builds/worker/checkouts/gecko/xpcom/ds/nsBaseHashtable.h:423:26
    #7 0x7fffe1d3e419 in operator()<nsTHashtable<nsBaseHashtableET<nsPtrHashKey<const mozilla::dom::Selection>, nsTBaseHashSet<nsPtrHashKey<const nsINode> > > >::EntryHandle> /builds/worker/checkouts/gecko/xpcom/ds/nsBaseHashtable.h:836:18
    #8 0x7fffe1d3e419 in operator()<PLDHashTable::EntryHandle> /builds/worker/checkouts/gecko/xpcom/ds/nsTHashtable.h:437:18
    #9 0x7fffe1d3e419 in WithEntryHandle<(lambda at /builds/worker/checkouts/gecko/xpcom/ds/nsTHashtable.h:436:9)> /builds/worker/checkouts/gecko/xpcom/ds/PLDHashTable.h:605:12
    #10 0x7fffe1d3e419 in WithEntryHandle<(lambda at /builds/worker/checkouts/gecko/xpcom/ds/nsBaseHashtable.h:835:15)> /builds/worker/checkouts/gecko/xpcom/ds/nsTHashtable.h:434:25
    #11 0x7fffe1d3e419 in WithEntryHandle<(lambda at /builds/worker/checkouts/gecko/xpcom/ds/nsBaseHashtable.h:422:34)> /builds/worker/checkouts/gecko/xpcom/ds/nsBaseHashtable.h:834:18
    #12 0x7fffe1d3e419 in LookupOrInsertWith<(lambda at /builds/worker/checkouts/gecko/dom/base/Selection.cpp:329:56)> /builds/worker/checkouts/gecko/xpcom/ds/nsBaseHashtable.h:422:12
    #13 0x7fffe1d3e419 in mozilla::dom::SelectionNodeCache::MaybeCollect(mozilla::dom::Selection const*) /builds/worker/checkouts/gecko/dom/base/Selection.cpp:329:25
    #14 0x7fffe1d4dcd3 in MaybeCollectNodesAndCheckIfFullySelected /builds/worker/checkouts/gecko/dom/base/Selection.h:94:12
    #15 0x7fffe1d4dcd3 in mozilla::dom::Selection::LookUpSelection(nsIContent*, unsigned int, unsigned int, mozilla::UniquePtr<SelectionDetails, mozilla::DefaultDelete<SelectionDetails>>, mozilla::SelectionType, bool) /builds/worker/checkouts/gecko/dom/base/Selection.cpp:2016:16
    #16 0x7fffe83e5baf in nsFrameSelection::LookUpSelection(nsIContent*, int, int, bool) const /builds/worker/checkouts/gecko/layout/generic/nsFrameSelection.cpp:1511:30
    #17 0x7fffe860a446 in GetSelectionDetails /builds/worker/checkouts/gecko/layout/generic/nsTextFrame.cpp:4761:57
    #18 0x7fffe860a446 in nsTextFrame::PaintTextWithSelection(nsTextFrame::PaintTextSelectionParams const&, nsTextFrame::ClipEdges const&) /builds/worker/checkouts/gecko/layout/generic/nsTextFrame.cpp:6484:41
    #19 0x7fffe860d082 in nsTextFrame::PaintText(nsTextFrame::PaintTextParams const&, int, int, nsPoint const&, bool, float) /builds/worker/checkouts/gecko/layout/generic/nsTextFrame.cpp:6865:9
    #20 0x7fffe89a49e9 in mozilla::nsDisplayText::RenderToContext(gfxContext*, mozilla::nsDisplayListBuilder*, nsRect const&, float, bool) /builds/worker/checkouts/gecko/layout/painting/nsDisplayList.cpp:7656:6
    #21 0x7fffe89a5435 in mozilla::nsDisplayText::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder&, mozilla::wr::IpcResourceUpdateQueue&, mozilla::layers::StackingContextHelper const&, mozilla::layers::RenderRootStateManager*, mozilla::nsDisplayListBuilder*) /builds/worker/checkouts/gecko/layout/painting/nsDisplayList.cpp:7578:3
    #22 0x7fffe0967ddb in mozilla::layers::WebRenderCommandBuilder::CreateWebRenderCommands(mozilla::nsDisplayItem*, mozilla::wr::DisplayListBuilder&, mozilla::wr::IpcResourceUpdateQueue&, mozilla::layers::StackingContextHelper const&, mozilla::nsDisplayListBuilder*) /builds/worker/checkouts/gecko/gfx/layers/wr/WebRenderCommandBuilder.cpp:1859:41
    #23 0x7fffe0965cbd in mozilla::layers::WebRenderCommandBuilder::CreateWebRenderCommandsFromDisplayList(mozilla::nsDisplayList*, mozilla::nsDisplayItem*, mozilla::nsDisplayListBuilder*, mozilla::layers::StackingContextHelper const&, mozilla::wr::DisplayListBuilder&, mozilla::wr::IpcResourceUpdateQueue&, bool) /builds/worker/checkouts/gecko/gfx/layers/wr/WebRenderCommandBuilder.cpp:2115:7
    #24 0x7fffe898a5ba in CreateWebRenderCommandsNewClipListOption /builds/worker/checkouts/gecko/layout/painting/nsDisplayList.cpp:4605:30
....

The original report as published on Mozilla's Bugzilla, by Atte Kettunen. 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 high-severity memory corruption bug in DOM: Selection. Mozilla made it public on 1 October 2024 as CVE-2024-9936.

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 Atte Kettunen

View all

62 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.