Skip to content

Commit

Permalink
Cherry-pick 3f0a2a4. rdar://problem/85597139
Browse files Browse the repository at this point in the history
    Crash in TextManipulationController::observeParagraphs on macrumors.com
    https://bugs.webkit.org/show_bug.cgi?id=258649

    Reviewed by Wenson Hsieh.

    In some cases, we can reach the end of shadow root without TextIterator hitting the end.
    We need to stop the iteration in such cases to avoid dereferencing nullptr.

    Unfortunately no new tests since I cannot create a reduction.

    * Source/WebCore/editing/TextManipulationController.cpp:
    (WebCore::ParagraphContentIterator::atEnd const):

    Canonical link: https://commits.webkit.org/265612@main

Identifier: 263823.1686@safari-7616.1.21-branch
  • Loading branch information
rniwa authored and MyahCobbs committed Jun 30, 2023
1 parent 181c467 commit d4e3f05
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Source/WebCore/editing/TextManipulationController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class ParagraphContentIterator {
return content;
}

bool atEnd() const { return !m_text && m_iterator.atEnd() && m_node == m_pastEndNode; }
bool atEnd() const { return !m_text && m_node == m_pastEndNode; }

private:
bool shouldAdvanceIteratorPastCurrentNode() const
Expand Down

0 comments on commit d4e3f05

Please sign in to comment.