High firefox Logic Error 🔧 Commit mapped

Overview

High
Severity
—
CVSS
No
Exploited ITW
Fixed
Fix Status
Impacthigh
DescriptionUse-after-free in the Layout component
ComponentLayout
Bug ClassLogic Error
Tracker2059110
Fix commitc4044389e238 (firefox) +3/-1
CISA KEVNot listed
CreditedMozilla
Disclosed2026-10-27

Files Changed

  • layout/generic/nsFrameSelection.cpp
diff --git a/layout/generic/nsFrameSelection.cpp b/layout/generic/nsFrameSelection.cpp
index 828c174039a..be22915490c 100644
--- a/layout/generic/nsFrameSelection.cpp
+++ b/layout/generic/nsFrameSelection.cpp
@@ -1225,8 +1225,10 @@ void nsFrameSelection::MaintainedRange::AdjustNormalSelection(
   if ((*relToStart <= 0 && *relToEnd >= 0) ||
       (*relToStart > 0 && aNormalSelection.GetDirection() == eDirNext) ||
       (*relToEnd < 0 && aNormalSelection.GetDirection() == eDirPrevious)) {
+    // Ensure we hold a strong ref to the range across ReplaceAnchorFocusRange.
+    const RefPtr range = mRange;
     // Set the current range to the maintained range.
-    aNormalSelection.ReplaceAnchorFocusRange(mRange);
+    aNormalSelection.ReplaceAnchorFocusRange(range);
     // Set the direction of the selection so that the anchor will be on the
     // far side of the maintained selection, relative to aContent/aOffset.
     aNormalSelection.SetDirection(*relToStart > 0 ? eDirPrevious : eDirNext);
Loading diff…