Crash in [@ mozilla::dom::TextDirectiveUtil::ComputeCommonSubstringLength<T>]
Categories
(Core :: DOM: Navigation, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr115 | --- | unaffected |
| firefox-esr140 | --- | unaffected |
| firefox143 | --- | unaffected |
| firefox144 | --- | disabled |
| firefox145 | + | fixed |
People
(Reporter: aryx, Assigned: jjaschke)
References
(Regression)
Details
(Keywords: crash, regression, topcrash)
Crash Data
Attachments
(1 file)
Similar to bug 1987845 after bug 1979588 relanded but with reduced crash volume.
Crash report: https://crash-stats.mozilla.org/report/index/85998ad3-d168-407b-b2bb-453450250910
MOZ_CRASH Reason:
MOZ_DIAGNOSTIC_ASSERT(!nsContentUtils::IsHTMLWhitespace(aReferenceString.First()))
Top 10 frames:
0 xul.dll mozilla::dom::TextDirectiveUtil::ComputeCommonSubstringLength<-1>(nsTSubstrin... dom/base/TextDirectiveUtil.h:554
1 xul.dll mozilla::dom::RangeBasedTextDirectiveCreator::FindEndMatchCommonSubstringLeng... dom/base/TextDirectiveCreator.cpp:624
2 xul.dll mozilla::dom::RangeBasedTextDirectiveCreator::FindAllMatchingCandidates() dom/base/TextDirectiveCreator.cpp:575
3 xul.dll mozilla::dom::TextDirectiveCreator::CreateTextDirectiveFromRange(mozilla::dom... dom/base/TextDirectiveCreator.cpp:57
4 xul.dll mozilla::dom::FragmentDirective::CreateTextDirectiveForRanges(mozilla::dom::S... dom/base/FragmentDirective.cpp:465
5 xul.dll mozilla::dom::FragmentDirective_Binding::createTextDirectiveForRanges(JSConte... dom/bindings/FragmentDirectiveBinding.cpp:194
5 xul.dll mozilla::dom::FragmentDirective_Binding::createTextDirectiveForRanges_promise... dom/bindings/FragmentDirectiveBinding.cpp:205
6 xul.dll mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::Nor... dom/bindings/BindingUtils.cpp:3308
7 xul.dll CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::... js/src/vm/Interpreter.cpp:501
7 xul.dll js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstru... js/src/vm/Interpreter.cpp:597
Updated•6 months ago
|
Comment 2•6 months ago
|
||
The bug is marked as tracked for firefox145 (nightly). However, the bug still isn't assigned, has low priority and has low severity.
:hsinyi, could you please find an assignee, increase the priority and increase the severity for this tracked bug? Given that it is a regression and we know the cause, we could also simply backout the regressor. If you disagree with the tracking decision, please talk with the release managers.
For more information, please visit BugBot documentation.
| Assignee | ||
Comment 3•6 months ago
|
||
This is a diagnostic assert. I'm still trying to reproduce. The "regressor" changed the asserts from MOZ_ASSERT to MOZ_DIAGNOSTIC_ASSERT. So it's not really a regression.
Updated•6 months ago
|
Updated•6 months ago
|
Comment 4•6 months ago
|
||
:smaug, could you consider increasing the severity of this top-crash bug?
For more information, please visit BugBot documentation.
Comment 5•6 months ago
|
||
Yes. This is still a very common issue.
jjaschke, I think the assertion should be changed to MOZ_ASSERT or something rather soon.
| Assignee | ||
Comment 6•6 months ago
|
||
I can reproduce the crash with a page that has this content:
test 1 1111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
test
When selecting the "test" at the end and then right-clicking.
The algorithm collects surrounding prefix and suffix text around the target range. Then it collects all other matches for the target range in the document, and compares the surrounding text of these matches to the prefix and suffix, to determine the length of the common substrings.
These prefix and suffix terms are cut off arbitrarily at a certain length (1024 chars) to avoid doing too much work -- if the first 1024 chars of a prefix and suffix are equal between the target range and a match, we give up (the URLs would become much too long in that case as well).
The code here cuts off at 1024 chars, but doesn't account for whitespace - if it happens that at that exact cutoff position there is whitespace, we run into the assert. The test case above does exactly that. After 1024 characters (reading from the right, because this is prefix) there is a whitespace character, so that the cutoff prefix consists of a whitespace followed by 1023 "1"; the same happens for the suffix code.
The fix is trivial -- don't cutoff at 1024 chars, but instead at a word boundary.
| Assignee | ||
Comment 7•6 months ago
|
||
Updated•6 months ago
|
Comment 9•6 months ago
|
||
| bugherder | ||
Description
•