<?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>273819</bug_id>
          
          <creation_ts>2024-05-07 05:04:55 -0700</creation_ts>
          <short_desc>Update implementation of TT enforcement for document.write/writeln</short_desc>
          <delta_ts>2024-06-11 03:42:34 -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>DOM</component>
          <version>Safari 17</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://github.com/web-platform-tests/wpt/pull/46141</see_also>
          <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>274567</dependson>
          <blocked>266630</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Luke Warlow">lwarlow</reporter>
          <assigned_to name="Luke Warlow">lwarlow</assigned_to>
          <cc>darbinyan</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2033705</commentid>
    <comment_count>0</comment_count>
    <who name="Luke Warlow">lwarlow</who>
    <bug_when>2024-05-07 05:04:55 -0700</bug_when>
    <thetext>See https://github.com/w3c/trusted-types/issues/510</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2033733</commentid>
    <comment_count>1</comment_count>
    <who name="Luke Warlow">lwarlow</who>
    <bug_when>2024-05-07 08:23:58 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/28238</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2033971</commentid>
    <comment_count>2</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-05-08 03:53:06 -0700</bug_when>
    <thetext>Committed 278501@main (e84b70e7fa81): &lt;https://commits.webkit.org/278501@main&gt;

Reviewed commits have been landed. Closing PR #28238 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2033972</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-05-08 03:54:16 -0700</bug_when>
    <thetext>&lt;rdar://problem/127728959&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2037187</commentid>
    <comment_count>4</comment_count>
    <who name="Marta Darbinyan">darbinyan</who>
    <bug_when>2024-05-22 17:10:13 -0700</bug_when>
    <thetext>This change causes crashes when running WK1 layout tests under ASan on Sonoma.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2037189</commentid>
    <comment_count>5</comment_count>
    <who name="Marta Darbinyan">darbinyan</who>
    <bug_when>2024-05-22 17:11:26 -0700</bug_when>
    <thetext>Will share a backtrace later.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2037343</commentid>
    <comment_count>6</comment_count>
    <who name="Marta Darbinyan">darbinyan</who>
    <bug_when>2024-05-23 09:22:38 -0700</bug_when>
    <thetext>This change was reverted.

Backtrace:

==37330==ERROR: AddressSanitizer: heap-use-after-free on address 0x00011879d524 at pc 0x000139c6a764 bp 0x00016d4984c0 sp 0x00016d4984b8
READ of size 1 at 0x00011879d524 thread T0
    #0 0x139c6a760 in WebCore::SegmentedString::appendSubstring(WebCore::SegmentedString::Substring&amp;&amp;)+0x594 (WebCore:arm64e+0x71ea760)
    #1 0x132af60bc in WebCore::SegmentedString::append(WebCore::SegmentedString const&amp;)+0xf8 (WebCore:arm64e+0x760bc)
    #2 0x13850c3b8 in WebCore::HTMLDocumentParser::insert(WebCore::SegmentedString&amp;&amp;)+0x470 (WebCore:arm64e+0x5a8c3b8)
    #3 0x137913e74 in WebCore::Document::write(WebCore::Document*, WebCore::SegmentedString&amp;&amp;)+0x208 (WebCore:arm64e+0x4e93e74)
    #4 0x1379145d8 in WebCore::Document::write(WebCore::Document*, WTF::FixedVector&lt;std::__1::variant&lt;WTF::RefPtr&lt;WebCore::TrustedHTML, WTF::RawPtrTraits&lt;WebCore::TrustedHTML&gt;, WTF::DefaultRefDerefTraits&lt;WebCore::TrustedHTML&gt;&gt;, WTF::String&gt;&gt;&amp;&amp;)+0x484 (WebCore:arm64e+0x4e945d8)
    #5 0x133df9828 in JSC::JSValue WebCore::toJS&lt;WebCore::IDLUndefined, WebCore::jsDocumentPrototypeFunction_writeBody(JSC::JSGlobalObject*, JSC::CallFrame*, WebCore::JSDocument*)::&apos;lambda&apos;()&gt;(JSC::JSGlobalObject&amp;, JSC::ThrowScope&amp;, WebCore::jsDocumentPrototypeFunction_writeBody(JSC::JSGlobalObject*, JSC::CallFrame*, WebCore::JSDocument*)::&apos;lambda&apos;()&amp;&amp;)+0x198 (WebCore:arm64e+0x1379828)
    #6 0x133df8978 in WebCore::jsDocumentPrototypeFunction_writeBody(JSC::JSGlobalObject*, JSC::CallFrame*, WebCore::JSDocument*)+0x25c (WebCore:arm64e+0x1378978)
    #7 0x133de7ad8 in WebCore::jsDocumentPrototypeFunction_write(JSC::JSGlobalObject*, JSC::CallFrame*)+0xe4 (WebCore:arm64e+0x1367ad8)
    #8 0x14013c140  (&lt;unknown module&gt;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2037601</commentid>
    <comment_count>7</comment_count>
    <who name="Luke Warlow">lwarlow</who>
    <bug_when>2024-05-24 05:20:14 -0700</bug_when>
    <thetext>Do you happen to have an example test that&apos;s crashing with that change to help me debug the cause?

I&apos;ve tried doing a local ASAN release build, with the change applied, and running the fast and WPT tests and so far none of them have crashed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2037788</commentid>
    <comment_count>8</comment_count>
    <who name="Luke Warlow">lwarlow</who>
    <bug_when>2024-05-24 15:43:45 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/29091</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2038290</commentid>
    <comment_count>9</comment_count>
    <who name="Marta Darbinyan">darbinyan</who>
    <bug_when>2024-05-28 14:44:37 -0700</bug_when>
    <thetext>Hi Luke, here is an example of the test that crashed on Asan builds that should help you debug. 

The command to reproduce: 
run-webkit-tests --release http/tests/inspector/network/resource-response-inspector-override.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2040766</commentid>
    <comment_count>10</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-06-11 03:42:32 -0700</bug_when>
    <thetext>Committed 279904@main (cfe83d0fa5bc): &lt;https://commits.webkit.org/279904@main&gt;

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

    </bug>

</bugzilla>