<?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>312594</bug_id>
          
          <creation_ts>2026-04-17 11:59:43 -0700</creation_ts>
          <short_desc>[WebKit][Main+SU] [0de8fcf584c54561] ASAN_ABRT | -[NSFileWrapper regularFileContents]; HTMLConverter::_addAttachmentForElement; HTMLConverter::_processElement</short_desc>
          <delta_ts>2026-04-20 12:39:18 -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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Kristian Monsen">k_monsen</reporter>
          <assigned_to name="Kristian Monsen">k_monsen</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2201608</commentid>
    <comment_count>0</comment_count>
    <who name="Kristian Monsen">k_monsen</who>
    <bug_when>2026-04-17 11:59:43 -0700</bug_when>
    <thetext>&lt;rdar://174642216&gt;

The attached testcase (mini-fuzz-8.html) crashes a Release ASan build of WebKit
Found by fuzzer WebKitTestRunner-h-case-as

This crash was seen 1 times during the past 7 days.

Testcase:

```
  &lt;script&gt;
  const nodes = new Map([[&apos;n0&apos;, new WeakRef(document.documentElement)]]);
try {
    function storeNode(key, node) {
    let weak = new WeakRef(node);
    nodes.set(key, weak);
}
    function getNodeSafe(key) {
    let weak = nodes.get(key);
    let node = weak.deref();
    return node;
}    
} catch (e) {
}
  (async () =&gt; {
try { (() =&gt; {
  let n29 = document.createElement(&apos;img&apos;);  n29.id = &apos;n4&apos;;
  getNodeSafe(&apos;n0&apos;).append(n29);
  storeNode(&apos;n29&apos;, n29);
})(); } catch {}
try { getNodeSafe(&apos;n29&apos;).srcset = `.`; } catch {}
try { document.execCommand(&apos;SelectAll&apos;); } catch {}
try { document.execCommand(&apos;Copy&apos;); } catch {}
})();
  &lt;/script&gt;
```

Reproduced on:

WebKit main @ 310634@main
WebKit SU @ 305413.617@safari-7624-branch

Reproduction Command:
DYLD_FRAMEWORK_PATH=$PWD DYLD_LIBRARY_PATH=$PWD __XPC_DYLD_FRAMEWORK_PATH=$PWD __XPC_DYLD_LIBRARY_PATH=$PWD ASAN_OPTIONS=handle_segv=2,handle_sigbus=2,handle_sigill=2,handle_abort=2,handle_sigtrap=2,allocator_may_return_null=1 __XPC_ASAN_OPTIONS=handle_segv=2,handle_sigbus=2,handle_sigill=2,handle_abort=2,handle_sigtrap=2,allocator_may_return_null=1 ./WebKitTestRunner --no-enable-all-experimental-feature --no-timeout fuzz-8.html fuzz-8.html

Crash Log:

AddressSanitizer:DEADLYSIGNAL
=================================================================
==45613==ERROR: AddressSanitizer: ABRT on unknown address 0x000185f0c5e8 (pc 0x000185f0c5e8 bp 0x00016b0abfe0 sp 0x00016b0abfc0 T0)
==45613==WARN: Invalid dyld module map detected. This is most likely a bug in the sanitizer.
==45613==WARN: Backtraces may be unreliable.
    #0 0x000185f0c5e8 in __pthread_kill+0x8 (libsystem_kernel.dylib:arm64e+0x95e8)
    #1 0x000185e4e78c in abort+0x90 (libsystem_c.dylib:arm64e+0x7878c)
    #2 0x000185efe728 in __abort_message+0x80 (libc++abi.dylib:arm64e+0x16728)
    #3 0x000185eeb584 in demangling_terminate_handler()+0x124 (libc++abi.dylib:arm64e+0x3584)
    #4 0x000185b08890 in _objc_terminate()+0x98 (libobjc.A.dylib:arm64e+0x24890)
    #5 0x000185efb758 in std::__terminate(void (*)())+0xc (libc++abi.dylib:arm64e+0x13758)
    #6 0x000185efdbe0 in __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*)+0x54 (libc++abi.dylib:arm64e+0x15be0)
    #7 0x000185eea098 in __cxa_throw+0x58 (libc++abi.dylib:arm64e+0x2098)
    #8 0x000185afea80 in objc_exception_throw+0x1bc (libobjc.A.dylib:arm64e+0x1aa80)
    #9 0x000187890454 in -[NSFileWrapper regularFileContents]+0x1b0 (Foundation:arm64e+0x9d454)
    #10 0x0001470fbad4 in HTMLConverter::_addAttachmentForElement(WebCore::Element&amp;, NSURL*, bool, bool)+0xb40 (WebCore:arm64e+0x13c7ad4)
    #11 0x00014710a608 in HTMLConverter::_processElement(WebCore::Element&amp;, long)+0x3298 (WebCore:arm64e+0x13d6608)
    #12 0x0001470e5f98 in HTMLConverter::_traverseNode(WebCore::Node&amp;, unsigned int, bool)+0x9b0 (WebCore:arm64e+0x13b1f98)
    #13 0x0001470e66c0 in HTMLConverter::_traverseNode(WebCore::Node&amp;, unsigned int, bool)+0x10d8 (WebCore:arm64e+0x13b26c0)
    #14 0x0001470e3c88 in HTMLConverter::convert()+0x498 (WebCore:arm64e+0x13afc88)
    #15 0x000147119494 in WebCore::attributedString(WebCore::SimpleRange const&amp;, WebCore::IgnoreUserSelectNone)+0x7ac (WebCore:arm64e+0x13e5494)
    #16 0x00014888a7b4 in WebCore::selectionAsAttributedString(WebCore::Document const&amp;)+0x504 (WebCore:arm64e+0x2b567b4)


Reproducibility:

Original testcase: 6/6 (100.0%) - Average time: 11.35s
Minimized testcase: 25/25 (100.0%) - Average time: 1.48s</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2201611</commentid>
    <comment_count>1</comment_count>
    <who name="Kristian Monsen">k_monsen</who>
    <bug_when>2026-04-17 12:04:10 -0700</bug_when>
    <thetext>Pull request: https://github.com/apple/WebKit/pull/4993</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2201730</commentid>
    <comment_count>2</comment_count>
    <who name="Kristian Monsen">k_monsen</who>
    <bug_when>2026-04-17 19:06:02 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/63020</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2202337</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-04-20 12:39:16 -0700</bug_when>
    <thetext>Committed 311610@main (dad1793d6498): &lt;https://commits.webkit.org/311610@main&gt;

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

    </bug>

</bugzilla>