Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 847494b22b263801ad9036d5ff89c5127b036fd5
      
https://github.com/WebKit/WebKit/commit/847494b22b263801ad9036d5ff89c5127b036fd5
  Author: Frédéric Wang <[email protected]>
  Date:   2025-04-14 (Mon, 14 Apr 2025)

  Changed paths:
    A LayoutTests/fast/editing/insert-list-hang-and-assert-expected.txt
    A LayoutTests/fast/editing/insert-list-hang-and-assert.html
    A 
LayoutTests/fast/frames/max-connected-subframe-count-with-lazy-loading-crash-expected.txt
    A 
LayoutTests/fast/frames/max-connected-subframe-count-with-lazy-loading-crash.html
    M LayoutTests/fast/ruby/crash-when-ruby-base-is-collapsed-expected.txt
    M LayoutTests/fast/text/selection-on-a-detached-tree-expected.txt
    M Source/WebCore/editing/InsertListCommand.cpp
    M Source/WebCore/editing/markup.cpp
    M Source/WebCore/loader/SubframeLoader.cpp
    M Source/WebCore/loader/SubframeLoader.h

  Log Message:
  -----------
  Fix connectedSubframeCount overflow with lazy frame loading.
https://bugs.webkit.org/show_bug.cgi?id=286833

Reviewed by Ryosuke Niwa.

HTMLFrameElementBase::openURL() calls createFrameIfNecessary() for lazy
loaded frames, which will unconditionally increments the value of
RareDataBitFields::connectedSubframeCount and can lead to a size
overflow for it. This patch makes sure it never exceeds the value of
Page::maxNumberOfFrames.

This bug was originally detected via a repro case that relies on
InsertListCommand::doApply() looping infinitely and hitting a debug
assertion in StyledMarkupAccumulator::textContentRespectingRange().
These two issues are also fixed in this patch.

* LayoutTests/fast/editing/insert-list-hang-and-assert-expected.txt: Added.
* LayoutTests/fast/editing/insert-list-hang-and-assert.html: Added. This is 
based on the original repro for the editor bugs.
* 
LayoutTests/fast/frames/max-connected-subframe-count-with-lazy-loading-crash-expected.txt:
 Added.
* 
LayoutTests/fast/frames/max-connected-subframe-count-with-lazy-loading-crash.html:
 Added. This is a direct test for the frame bug.
* LayoutTests/fast/ruby/crash-when-ruby-base-is-collapsed-expected.txt: Update 
expectation.
* LayoutTests/fast/text/selection-on-a-detached-tree-expected.txt: Update 
expectation.
* Source/WebCore/editing/InsertListCommand.cpp:
(WebCore::InsertListCommand::doApply): Make sure startOfCurrentParagraph always 
moves forward, so that we eventually stop.
* Source/WebCore/editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::textContentRespectingRange): Don't assert 
for start == end. This handles the case when
m_start.containerNode() is before the Text node and the m_end is offset 0 in 
the Text node.
* Source/WebCore/loader/SubframeLoader.cpp:
(WebCore::FrameLoader::SubframeLoader::canCreateSubFrame const): Introduce a 
helper for some conditons of FrameLoader::SubframeLoader::loadSubframe.
(WebCore::FrameLoader::SubframeLoader::createFrameIfNecessary): Use 
canCreateSubFrame().
(WebCore::FrameLoader::SubframeLoader::loadSubframe): Ditto.
* Source/WebCore/loader/SubframeLoader.h: Declare canCreateSubFrame().

Originally-landed-as: [email protected] (abbb214798c6). 
rdar://148057418
Canonical link: https://commits.webkit.org/293666@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to