Closed Bug 2057692 Opened 2 months ago Closed 2 months ago

Assertion failure: pointInFlat->IsSetAndValid(), at checkouts/gecko/dom/base/nsRange.cpp:1263

Categories

(Core :: DOM: Selection, defect)

defect

Tracking

()

VERIFIED FIXED
155 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr140 --- unaffected
firefox-esr153 --- unaffected
firefox153 --- unaffected
firefox154 --- fixed
firefox155 --- verified

People

(Reporter: tsmith, Assigned: masayuki)

References

(Blocks 2 open bugs, Regression)

Details

(Keywords: assertion, regression, testcase, Whiteboard: [bugmon:bisected,confirmed], [wptsync upstream])

Attachments

(3 files)

Attached file testcase.html —

Found while fuzzing m-c 20260709-5b3db67631ae (--enable-debug --enable-fuzzing)

To reproduce via Grizzly Replay:

$ pip install fuzzfetch grizzly-framework --upgrade
$ python -m fuzzfetch -d --fuzzing -n firefox
$ python -m grizzly.replay.bugzilla ./firefox/firefox <bugid>

Assertion failure: pointInFlat->IsSetAndValid(), at checkouts/gecko/dom/base/nsRange.cpp:1263

#0 0x7feef95d359a in MOZ_CrashSequence /builds/worker/workspace/obj-build/dist/include/mozilla/Assertions.h:261:3
#1 0x7feef95d359a in nsRange::SetStartInternal(mozilla::RangeBoundaryBase<nsINode*, nsIContent*> const&, mozilla::dom::AllowRangeCrossShadowBoundary, mozilla::ErrorResult&) /builds/worker/workspace/obj-build/dom/base/./../../../../checkouts/gecko/dom/base/nsRange.cpp:1263:3
#2 0x7feef9806d4e in mozilla::dom::Selection::ExtendInternal(nsINode&, unsigned int, mozilla::ErrorResult&) /builds/worker/workspace/obj-build/dom/base/./../../../../checkouts/gecko/dom/base/Selection.cpp:3341:14
#3 0x7feef9807d36 in mozilla::dom::Selection::Extend(nsINode*, unsigned int) /builds/worker/workspace/obj-build/dom/base/./../../../../checkouts/gecko/dom/base/Selection.cpp:3190:3
#4 0x7feefd9f0a03 in nsFrameSelection::TakeFocus(nsIContent&, unsigned int, unsigned int, mozilla::CaretAssociationHint, nsFrameSelection::FocusMode) /builds/worker/workspace/obj-build/layout/generic/./../../../../checkouts/gecko/layout/generic/nsFrameSelection.cpp:1575:20
#5 0x7feefd9f1812 in nsFrameSelection::HandleClick(nsIContent*, unsigned int, unsigned int, nsFrameSelection::FocusMode, mozilla::CaretAssociationHint) /builds/worker/workspace/obj-build/layout/generic/./../../../../checkouts/gecko/layout/generic/nsFrameSelection.cpp:1321:12
#6 0x7feefd848387 in mozilla::PresShell::CompleteMove(bool, bool) /builds/worker/workspace/obj-build/layout/base/./../../../../checkouts/gecko/layout/base/PresShell.cpp:2465:19
#7 0x7feef980d8a7 in mozilla::dom::Selection::Modify(nsTSubstring<char16_t> const&, nsTSubstring<char16_t> const&, nsTSubstring<char16_t> const&) /builds/worker/workspace/obj-build/dom/base/./../../../../checkouts/gecko/dom/base/Selection.cpp:4316:16
#8 0x7feefa26ad14 in mozilla::dom::Selection_Binding::modify(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/./SelectionBinding.cpp:1614:24
#9 0x7feefab3a515 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/obj-build/dom/bindings/./../../../../checkouts/gecko/dom/bindings/BindingUtils.cpp:3216:13
#10 0x7feeff95cc04 in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:498:13
#11 0x7feeff95c4bf in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:594:12
#12 0x7feefeee2016 in js::jit::DoCallFallback(JSContext*, js::jit::BaselineFrame*, js::jit::ICFallbackStub*, unsigned int, JS::Value*, JS::MutableHandle<JS::Value>) /builds/worker/workspace/obj-build/js/src/jit/./../../../../../checkouts/gecko/js/src/jit/BaselineIC.cpp:1717:10
Flags: in-testsuite?

This was also detected by live site testing.

Blocks: crash-scout

Verified bug as reproducible on mozilla-central 20260726215019-babfc4cf0664.
The bug appears to have been introduced in the following build range:

Start: 1d8c624a9d81b5a24c56b5f86abe485288a43265 (20260705201657)
End: 293c7c1a753c7165757c183bbd0448a27b12639c (20260706042047)
Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=1d8c624a9d81b5a24c56b5f86abe485288a43265&tochange=293c7c1a753c7165757c183bbd0448a27b12639c

Keywords: regression
Whiteboard: [bugmon:bisected,confirmed]

:masayuki, since you are the author of the regressor, bug 2009328, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(masayuki)

This is just a bug of IsSetAndValid(). So, working with the point does not cause any problems, but some handling may fail with checking the result of the method.

Assignee: nobody → masayuki
Severity: -- → S3
Status: NEW → ASSIGNED
Flags: needinfo?(masayuki)
OS: Unspecified → All
Hardware: Unspecified → All

If mTreeKind is for TreeKind::FlatForSelection, mParent->Length()
is wrong API if mParent is a shadow host or a <slot> which has
some assigned nodes.

Pushed by masayuki@d-toybox.com: https://github.com/mozilla-firefox/firefox/commit/59f0d745d02c https://hg.mozilla.org/integration/autoland/rev/a34b6a93d7a8 Make `RangeBoundaryBase::IsSetAndValid()` use right API to get the max offset of the parent r=jjaschke

Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/61591 for changes under testing/web-platform/tests

Whiteboard: [bugmon:bisected,confirmed] → [bugmon:bisected,confirmed], [wptsync upstream]
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 155 Branch

The patch landed in nightly and beta is affected.
:masayuki, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(masayuki)

If mTreeKind is for TreeKind::FlatForSelection, mParent->Length()
is wrong API if mParent is a shadow host or a <slot> which has
some assigned nodes.

Original Revision: https://phabricator.services.mozilla.com/D314582

Attachment #9618013 - Flags: approval-mozilla-beta?

firefox-beta Uplift Approval Request

  • User impact if declined/Reason for urgency: This is a bug of the validator method and that may return opposite result from the actual state. Therefore, users may see unexpected result in some cases.
  • Code covered by automated testing?: yes
  • Fix verified in Nightly?: yes
  • Needs manual QE testing?: no
  • Steps to reproduce for manual QE testing:
  • Risk associated with taking this patch: low
  • Explanation of risk level: This just makes the validation API to use the correct API to get the length (number of children) of the parent node in the flattened tree.
  • String changes made/needed?: no
  • Is Android affected?: yes
Flags: needinfo?(masayuki)

Verified bug as fixed on rev mozilla-central 20260729041430-9654bd949e36.
Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.

Status: RESOLVED → VERIFIED
Keywords: bugmon

Upstream PR merged by moz-wptsync-bot

Attachment #9618013 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: