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

  Changed paths:
    M Source/WebKit/Scripts/IPCTestingHeaders-input.xcfilelist
    M Source/WebKit/Scripts/IPCTestingHeaders-output.xcfilelist
    M Source/WebKit/Shared/WebFoundTextRange.h
    M Tools/TestWebKitAPI/CMakeLists.txt
    M Tools/TestWebKitAPI/PlatformMac.cmake
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    A Tools/TestWebKitAPI/Tests/IPC/WebFoundTextRangeTests.cpp

  Log Message:
  -----------
  Fix iOS Find in Page Crash
https://bugs.webkit.org/show_bug.cgi?id=319936
rdar://182817126

Reviewed by David Kilzer.

The original fix: 316114@main, did not catch all the crashes.

The crash happens when a zero-length text match is added to
m_cachedFoundRanges in WebFoundTextRangeController. The zero-length
text match matches the emptyValue() of the HashMap of WebFoundTextRange
as it's key type. This trips the RELEASE_ASSERT that checks if the key
is valid.

To fix this issue, I changed definition of the WebFoundTextRange empty
value to be a DOM text match that would be impossible to create.

Test: Tools/TestWebKitAPI/Tests/IPC/WebFoundTextRangeTests.cpp

* Source/WebKit/Shared/WebFoundTextRange.h:
(WTF::HashTraits<WebKit::WebFoundTextRange>::emptyValue):
* Tools/TestWebKitAPI/CMakeLists.txt:
* Tools/TestWebKitAPI/PlatformMac.cmake:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/IPC/WebFoundTextRangeTests.cpp: Added.
(TestWebKitAPI::zeroLengthMainFrameMatch):
(TestWebKitAPI::TEST(WebFoundTextRange, 
EmptyValueDoesNotAliasZeroLengthMainFrameMatch)):
(TestWebKitAPI::TEST(WebFoundTextRange, 
InsertingZeroLengthMainFrameMatchDoesNotCrash)):
(TestWebKitAPI::TEST(WebFoundTextRange, 
ValidatedMapSupportsMultipleDOMMatches)):

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



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

Reply via email to