Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e3bc700a28feffa664c774e3347956273a3b4952
      
https://github.com/WebKit/WebKit/commit/e3bc700a28feffa664c774e3347956273a3b4952
  Author: Cole Carley <[email protected]>
  Date:   2026-07-02 (Thu, 02 Jul 2026)

  Changed paths:
    A 
LayoutTests/editing/text-iterator/find-matches-oversized-buffer-fallback-expected.txt
    A 
LayoutTests/editing/text-iterator/find-matches-oversized-buffer-fallback.html
    A 
LayoutTests/editing/text-iterator/find-oversized-shadow-scope-fallback-expected.txt
    A 
LayoutTests/editing/text-iterator/find-oversized-shadow-scope-fallback.html
    M Source/WebCore/editing/CachedMatchFinder.cpp
    M Source/WebCore/editing/CachedMatchFinder.h
    M Source/WebCore/editing/Editor.cpp
    M Source/WebCore/testing/Internals.cpp
    M Source/WebCore/testing/Internals.h
    M Source/WebCore/testing/Internals.idl

  Log Message:
  -----------
  Large pages can overflow the CachedMatchFinder buffer
https://bugs.webkit.org/show_bug.cgi?id=318124
rdar://179205821

Reviewed by Megan Gardner.

Large pages are causing the CachedMatchFinder's buffer to overflow. To fix this,
I have added a check for this overflow, which sets an oversized flag on the 
buffer.
Then, if CachedMatchFinder's findMatchFrom, findMatches, or countMatches tries 
to use
a buffer that has been overflowed, it returns an unexpected
CachedMatchFinder::CacheUnusable, signalling they should fall back to the old 
implementation.

Test: editing/text-iterator/find-matches-oversized-buffer-fallback.html

* 
LayoutTests/editing/text-iterator/find-matches-oversized-buffer-fallback-expected.txt:
 Added.
* 
LayoutTests/editing/text-iterator/find-matches-oversized-buffer-fallback.html: 
Added.
* Source/WebCore/editing/CachedMatchFinder.cpp:
(WebCore::maximumRunCountForTesting):
(WebCore::CachedMatchFinder::setMaximumRunCountForTesting):
(WebCore::CachedMatchFinder::findNextMatchInShadowIncludingAncestorTree):
(WebCore::CachedMatchFinder::findMatchFrom):
(WebCore::CachedMatchFinder::findMatches):
(WebCore::CachedMatchFinder::countMatches):
(WebCore::CachedMatchFinder::bufferForOptions):
(WebCore::CachedMatchFinder::textForScope):
* Source/WebCore/editing/CachedMatchFinder.h:
* Source/WebCore/editing/Editor.cpp:
(WebCore::Editor::findString):
(WebCore::Editor::countMatchesForText):
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setCachedFindMatchBufferLimitForTesting):
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to