<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>317083</bug_id>
          
          <creation_ts>2026-06-13 19:28:23 -0700</creation_ts>
          <short_desc>REGRESSION (311049@main): Clamp the word-boundary search index to the context buffer length in isWordStartMatch()</short_desc>
          <delta_ts>2026-06-15 13:43:08 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>HTML Editing</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>309323</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="David Kilzer (:ddkilzer)">ddkilzer</reporter>
          <assigned_to name="David Kilzer (:ddkilzer)">ddkilzer</assigned_to>
          <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2220653</commentid>
    <comment_count>0</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2026-06-13 19:28:23 -0700</bug_when>
    <thetext>Find-in-page and Scroll-to-Text-Fragment word-boundary matching can read out of bounds.

When a find match with the `AtWordStarts` option begins within a complex-context script run (for example Thai) but extends past that run into characters that do not require dictionary context, the word-boundary context window is trimmed to the complex-context run while the match length is not re-clamped to the trimmed window.

This regressed in 311049@main (Bug 309323, &quot;Improve find in page performance by using a cached flat buffer&quot;), which introduced the cached flat buffer that is trimmed to a context window.

Stack trace:
```
0   libsystem_platform.dylib:  _platform_memmove
1   WebCore:  WebCore::findNextWordFromIndex
2   WebCore:  WebCore::isWordStartMatch
3   WebCore:  WebCore::CachedMatchFinder::performSearch
4   WebCore:  WebCore::CachedMatchFinder::findMatchFrom
5   WebCore:  WebCore::Editor::findString
6   WebCore:  WebCore::Page::findString
7   WebKit:  WebKit::FindController::findString
[...]
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2220654</commentid>
    <comment_count>1</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2026-06-13 19:28:26 -0700</bug_when>
    <thetext>&lt;rdar://problem/179591659&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2220660</commentid>
    <comment_count>2</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2026-06-13 19:59:38 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/67146</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2220926</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-06-15 13:43:06 -0700</bug_when>
    <thetext>Committed 315233@main (03015890a6a2): &lt;https://commits.webkit.org/315233@main&gt;

Reviewed commits have been landed. Closing PR #67146 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>