<?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>286307</bug_id>
          
          <creation_ts>2025-01-21 10:49:37 -0800</creation_ts>
          <short_desc>nullptr crash | WebCore::isScriptElement; WebCore::SVGAnimatedString::setBaseVal;</short_desc>
          <delta_ts>2025-01-21 22:12:15 -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>SVG</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="Adan Lopez">ja_lopezlozoya</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>darin</cc>
    
    <cc>rniwa</cc>
    
    <cc>sabouhallawa</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2088726</commentid>
    <comment_count>0</comment_count>
    <who name="Adan Lopez">ja_lopezlozoya</who>
    <bug_when>2025-01-21 10:49:37 -0800</bug_when>
    <thetext>We are calling isScriptElement with passing an element that is null so we needed to add a null check before calling that function.

Test case:
&lt;p&gt;This test passes if it doesn&apos;t crash.&lt;/p&gt;
&lt;script&gt;
if (testRunner)
    testRunner.dumpAsText();

let animatedString = (() =&gt; {
    return (new Document).createElementNS(&apos;http://www.w3.org/2000/svg&apos;, &apos;text&apos;).className;
})();

if (window.GCController)
    GCController.collect();

animatedString.baseVal = &apos;foo&apos;;
let newValue = animatedString.baseVal;
document.write(newValue == &apos;foo&apos; ? &apos;PASS&apos; : `FAIL - ${newValue}`);

&lt;/script&gt;


Backtrace:
#0 0x13ad0e43c in WebCore::isScriptElement(WebCore::Element&amp;)+0x38 (/Users/lopezlozoya/repo/OpenSource/WebKitBuild/Release/WebCore.framework/Versions/A/WebCore:arm64e+0x5d3643c)
    #1 0x13e7e023c in WebCore::SVGAnimatedString::setBaseVal(std::__1::variant&lt;WTF::String, WTF::RefPtr&lt;WebCore::TrustedScriptURL, WTF::RawPtrTraits&lt;WebCore::TrustedScriptURL&gt;, WTF::DefaultRefDerefTraits&lt;WebCore::TrustedScriptURL&gt;&gt;&gt; const&amp;)+0xf4 (/Users/lopezlozoya/repo/OpenSource/WebKitBuild/Release/WebCore.framework/Versions/A/WebCore:arm64e+0x980823c)
    #2 0x137464238 in WebCore::setJSSVGAnimatedString_baseValSetter(JSC::JSGlobalObject&amp;, WebCore::JSSVGAnimatedString&amp;, JSC::JSValue)+0x260 (/Users/lopezlozoya/repo/OpenSource/WebKitBuild/Release/WebCore.framework/Versions/A/WebCore:arm64e+0x248c238)
    #3 0x1373c163c in WebCore::setJSSVGAnimatedString_baseVal(JSC::JSGlobalObject*, long long, long long, JSC::PropertyName)+0x14c (/Users/lopezlozoya/repo/OpenSource/WebKitBuild/Release/WebCore.framework/Versions/A/WebCore:arm64e+0x23e963c)
    #4 0x11ffe8d2c in JSC::JSObject::putInlineSlow(JSC::JSGlobalObject*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&amp;)+0x6a4 (/Users/lopezlozoya/repo/OpenSource/WebKitBuild/Release/JavaScriptCore.framework/Versions/A/JavaScriptCore:arm64e+0x3250d2c)
    #5 0x11f715644 in operationPutByIdSloppyOptimize+0x6e0 (/Users/lopezlozoya/repo/OpenSource/WebKitBuild/Release/JavaScriptCore.framework/Versions/A/JavaScriptCore:arm64e+0x297d644)
    #6 0x1461b8110  (&lt;unknown module&gt;)
    #7 0x146181304  (&lt;unknown module&gt;)
    #8 0x14641f834  (&lt;unknown module&gt;)
    #9 0x14614c544  (&lt;unknown module&gt;)
    #10 0x11f4d5c94 in JSC::Interpreter::executeCall(JSC::JSObject*, JSC::CallData const&amp;, JSC::JSValue, JSC::ArgList const&amp;)+0x838 (/Users/lopezlozoya/repo/OpenSource/WebKitBuild/Release/JavaScriptCore.framework/Versions/A/JavaScriptCore:arm64e+0x273dc94)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2088727</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-01-21 10:49:50 -0800</bug_when>
    <thetext>&lt;rdar://problem/143330345&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2088729</commentid>
    <comment_count>2</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2025-01-21 11:00:32 -0800</bug_when>
    <thetext>Is a null pointer dereference a heap-use-after-free?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2088733</commentid>
    <comment_count>3</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2025-01-21 11:03:13 -0800</bug_when>
    <thetext>The fix to this null pointer dereference is super-simple:

isScriptElement(*el) needs to become isScriptElement(el) without the *.

I am surprised that it’s a security issue though. Seems more like a non-security fuzzing blocker to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2088734</commentid>
    <comment_count>4</comment_count>
    <who name="Adan Lopez">ja_lopezlozoya</who>
    <bug_when>2025-01-21 11:05:36 -0800</bug_when>
    <thetext>Thanks for the feedback Darin, I&apos;ll try that approach. This was classified as Security from a fuzzer so I created the bug with the same classification.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2088742</commentid>
    <comment_count>5</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2025-01-21 11:12:57 -0800</bug_when>
    <thetext>Sounds OK. I wonder how the fuzzer classifies things. It’s possible that it is right and I am wrong, but I would like to understand eventually.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2088754</commentid>
    <comment_count>6</comment_count>
    <who name="Adan Lopez">ja_lopezlozoya</who>
    <bug_when>2025-01-21 11:34:47 -0800</bug_when>
    <thetext>Pull request: https://github.com/apple/WebKit/pull/2461</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2088763</commentid>
    <comment_count>7</comment_count>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2025-01-21 11:52:25 -0800</bug_when>
    <thetext>rdar://143330345</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2088764</commentid>
    <comment_count>8</comment_count>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2025-01-21 11:54:22 -0800</bug_when>
    <thetext>rdar://141021945</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2088825</commentid>
    <comment_count>9</comment_count>
    <who name="Adan Lopez">ja_lopezlozoya</who>
    <bug_when>2025-01-21 15:25:03 -0800</bug_when>
    <thetext>This was reclassified as non security bug. It is C/H/D bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2088826</commentid>
    <comment_count>10</comment_count>
    <who name="Adan Lopez">ja_lopezlozoya</who>
    <bug_when>2025-01-21 15:28:33 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/39349</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2088888</commentid>
    <comment_count>11</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-01-21 22:12:13 -0800</bug_when>
    <thetext>Committed 289221@main (a722b348044c): &lt;https://commits.webkit.org/289221@main&gt;

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

    </bug>

</bugzilla>