<?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>284408</bug_id>
          
          <creation_ts>2024-12-10 14:30:53 -0800</creation_ts>
          <short_desc>OOB crash under WebKit::dataProviderGetBytesAtPositionCallback during off-main-thread incremental PDF loading</short_desc>
          <delta_ts>2025-01-31 17:14:49 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>PDF</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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Abrar Rahman Protyasha">a_protyasha</reporter>
          <assigned_to name="Jonathan Bedard">jbedard</assigned_to>
          <cc>a_protyasha</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2080636</commentid>
    <comment_count>0</comment_count>
    <who name="Abrar Rahman Protyasha">a_protyasha</who>
    <bug_when>2024-12-10 14:30:53 -0800</bug_when>
    <thetext>rdar://131110151</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2080639</commentid>
    <comment_count>1</comment_count>
    <who name="Abrar Rahman Protyasha">a_protyasha</who>
    <bug_when>2024-12-10 14:34:03 -0800</bug_when>
    <thetext>Representative crash:

```
Thread 4 Crashed::   Dispatch queue: LinearizedPagePreload
0 _platform_memmove + 96
1 void WTF::memcpySpan&lt;unsigned char, 18446744073709551615ul, unsigned char const, 18446744073709551615ul&gt;(std::__1::span&lt;unsigned char, 18446744073709551615ul&gt;, std::__1::span&lt;unsigned char const, 18446744073709551615ul&gt;) + 16
2 WebKit::PDFIncrementalLoader::dataProviderGetBytesAtPosition(std::__1::span&lt;unsigned char, 18446744073709551615ul&gt;, long long) + 52
3 WebKit::dataProviderGetBytesAtPositionCallback(void*, void*, long long, unsigned long) + 308
4 provider_get_bytes_at_position + 84
5 CGDataProviderDirectGetBytesAtPositionInternal + 308
```

My current leading hypothesis is that the source buffer for the memcpy is nulled out before using it but after fetching it from the plugin. We should guard this work behind the data lock used for the buffer, too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2080643</commentid>
    <comment_count>2</comment_count>
    <who name="Abrar Rahman Protyasha">a_protyasha</who>
    <bug_when>2024-12-10 15:04:01 -0800</bug_when>
    <thetext>Pull request: https://github.com/apple/WebKit/pull/2388</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2080767</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-12-11 00:01:45 -0800</bug_when>
    <thetext>Committed 283286.578@safari-7620-branch (de6e83ab1f4d): &lt;https://commits.webkit.org/283286.578@safari-7620-branch&gt;

Reviewed commits have been landed. Closing PR #2388 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2082036</commentid>
    <comment_count>4</comment_count>
    <who name="Jonathan Bedard">jbedard</who>
    <bug_when>2024-12-16 07:59:08 -0800</bug_when>
    <thetext>&lt;rdar://problem/141548517&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2082039</commentid>
    <comment_count>5</comment_count>
    <who name="Jonathan Bedard">jbedard</who>
    <bug_when>2024-12-16 08:04:00 -0800</bug_when>
    <thetext>Re-opening for pull request https://github.com/apple/WebKit/pull/2406</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2082056</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-12-16 09:15:32 -0800</bug_when>
    <thetext>Committed 283286.595@safari-7620-branch (0053acf9bc55): &lt;https://commits.webkit.org/283286.595@safari-7620-branch&gt;

Reviewed commits have been landed. Closing PR #2406 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2090494</commentid>
    <comment_count>7</comment_count>
    <who name="Robert Jenner">jenner</who>
    <bug_when>2025-01-29 12:21:31 -0800</bug_when>
    <thetext>&lt;rdar://problem/143592990&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2091131</commentid>
    <comment_count>8</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-01-31 17:14:49 -0800</bug_when>
    <thetext>Committed 289647@main (1c283c67a9c0): &lt;https://commits.webkit.org/289647@main&gt;

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

    </bug>

</bugzilla>