<?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>312298</bug_id>
          
          <creation_ts>2026-04-14 12:21:08 -0700</creation_ts>
          <short_desc>Uninitialized memory write in WebCore::ContentExtensions::SerializedNFA::serialize</short_desc>
          <delta_ts>2026-05-01 06:24:19 -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>WebCore Misc.</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</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="Michael Catanzaro">mcatanzaro</reporter>
          <assigned_to name="Chris Dumez">cdumez</assigned_to>
          <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2200307</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2026-04-14 12:21:08 -0700</bug_when>
    <thetext>There is a decent chance this warning is a false positive, because sometimes when serializing a foobar it&apos;s just not a problem if some padding bytes are garbage, as the garbage will be ignored when they are deserialized. But we should still fix it in order to not trip valgrind.

==444078== Thread 20 ileSystem Queue:
==444078== Syscall param write(buf) points to uninitialised byte(s)
==444078==    at 0x61EC5FD: write (write.c:26)
==444078==    by 0xDF97C2A: WTF::FileSystemImpl::FileHandle::write(std::span&lt;unsigned char const, 18446744073709551615ul&gt;) (Source/WTF/wtf/posix/FileHandlePOSIX.cpp:63)
==444078==    by 0xA13E20D: writeAllToFile&lt;WTF::Vector&lt;WebCore::ContentExtensions::ImmutableRange&lt;char&gt;, 0UL, WTF::UnsafeVectorOverflow, 16UL, WTF::FastMalloc&gt; &gt; (Source/WebCore/contentextensions/SerializedNFA.cpp:44)
==444078==    by 0xA13E20D: WebCore::ContentExtensions::SerializedNFA::serialize(WebCore::ContentExtensions::NFA&amp;&amp;) (Source/WebCore/contentextensions/SerializedNFA.cpp:59)
==444078==    by 0xA13D092: WebCore::ContentExtensions::NFAToDFA::convert(WebCore::ContentExtensions::NFA&amp;&amp;) (Source/WebCore/contentextensions/NFAToDFA.cpp:320)
==444078==    by 0xA12ADB6: operator() (Source/WebCore/contentextensions/ContentExtensionCompiler.cpp:246)
==444078==    by 0xA12ADB6: WTF::Detail::CallableWrapper&lt;WebCore::ContentExtensions::compileToBytecode&lt;WebCore::ContentExtensions::compileRuleList(WebCore::ContentExtensions::ContentExtensionCompilationClient&amp;, WTF::String&amp;&amp;, WTF::Vector&lt;WebCore::ContentExtensions::ContentExtensionRule, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt;&amp;&amp;)::$_0&gt;(WebCore::ContentExtensions::CombinedURLFilters&amp;&amp;, WTF::HashSet&lt;unsigned long, WTF::DefaultHash&lt;unsigned long&gt;, WTF::UnsignedWithZeroKeyHashTraits&lt;unsigned long&gt;, WTF::HashTableTraits, (WTF::ShouldValidateKey)1&gt;&amp;&amp;, WebCore::ContentExtensions::compileRuleList(WebCore::ContentExtensions::ContentExtensionCompilationClient&amp;, WTF::String&amp;&amp;, WTF::Vector&lt;WebCore::ContentExtensions::ContentExtensionRule, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt;&amp;&amp;)::$_0)::{lambda(WebCore::ContentExtensions::NFA&amp;&amp;)#1}, bool, WebCore::ContentExtensions::NFA&amp;&amp;&gt;::call(WebCore::ContentExtensions::NFA&amp;&amp;) (Function.h:59)
==444078==    by 0xA113132: operator() (Function.h:103)
==444078==    by 0xA113132: WebCore::ContentExtensions::CombinedURLFilters::processNFAs(unsigned long, WTF::Function&lt;bool (WebCore::ContentExtensions::NFA&amp;&amp;)&gt;&amp;&amp;) (Source/WebCore/contentextensions/CombinedURLFilters.cpp:445)
==444078==    by 0xA11CEA9: compileToBytecode&lt;(lambda at /home/mcatanzaro/Projects/WebKit/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp:397:90)&gt; (Source/WebCore/contentextensions/ContentExtensionCompiler.cpp:240)
==444078==    by 0xA11CEA9: WebCore::ContentExtensions::compileRuleList(WebCore::ContentExtensions::ContentExtensionCompilationClient&amp;, WTF::String&amp;&amp;, WTF::Vector&lt;WebCore::ContentExtensions::ContentExtensionRule, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt;&amp;&amp;) (Source/WebCore/contentextensions/ContentExtensionCompiler.cpp:397)
==444078==    by 0x8BEE8F8: compiledToFile (Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp:416)
==444078==    by 0x8BEE8F8: operator() (Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp:618)
==444078==    by 0x8BEE8F8: WTF::Detail::CallableWrapper&lt;API::ContentRuleListStore::compileContentRuleListFile(WTF::String&amp;&amp;, WTF::String&amp;&amp;, WTF::String&amp;&amp;, WebCore::ContentExtensions::CSSSelectorsAllowed, WTF::CompletionHandler&lt;void (WTF::RefPtr&lt;API::ContentRuleList, WTF::RawPtrTraits&lt;API::ContentRuleList&gt;, WTF::DefaultRefDerefTraits&lt;API::ContentRuleList&gt; &gt;, std::error_code)&gt;)::$_0, void&gt;::call() (Function.h:59)
==444078==    by 0xDECF804: operator() (Source/WTF/wtf/Function.h:103)
==444078==    by 0xDECF804: WTF::RunLoop::performWork() (Source/WTF/wtf/RunLoop.cpp:145)
==444078==  Address 0x49aa03ba is 10 bytes inside a block of size 631,164 alloc&apos;d
==444078==    at 0x4841B26: malloc (vg_replace_malloc.c:447)
==444078==    by 0xDFAD9A4: pas_system_heap_allocate(unsigned long, unsigned long, pas_allocation_mode) (Source/bmalloc/libpas/src/libpas/pas_system_heap.h:145)
==444078==    by 0xA1292D3: malloc (FastMalloc.h:230)
==444078==    by 0xA1292D3: allocateBuffer&lt;(WTF::FailureAction)0&gt; (Vector.h:235)
==444078==    by 0xA1292D3: reserveCapacity&lt;(WTF::FailureAction)0&gt; (Vector.h:1371)
==444078==    by 0xA1292D3: expandCapacity&lt;(WTF::FailureAction)0&gt; (Vector.h:1221)
==444078==    by 0xA1292D3: WebCore::ContentExtensions::ImmutableRange&lt;char&gt;* WTF::Vector&lt;WebCore::ContentExtensions::ImmutableRange&lt;char&gt;, 0ul, WTF::UnsafeVectorOverflow, 16ul, WTF::FastMalloc&gt;::expandCapacity&lt;(WTF::FailureAction)0&gt;(unsigned long, WebCore::ContentExtensions::ImmutableRange&lt;char&gt;*) (Vector.h:1230)
==444078==    by 0xA128E9F: appendSlowCase&lt;(WTF::FailureAction)0, WebCore::ContentExtensions::ImmutableRange&lt;char&gt; &gt; (Vector.h:1531)
==444078==    by 0xA128E9F: append&lt;(WTF::FailureAction)0, WebCore::ContentExtensions::ImmutableRange&lt;char&gt; &gt; (Vector.h:1506)
==444078==    by 0xA128E9F: append&lt;WebCore::ContentExtensions::ImmutableRange&lt;char&gt; &gt; (Vector.h:829)
==444078==    by 0xA128E9F: append (Vector.h:827)
==444078==    by 0xA128E9F: WebCore::ContentExtensions::ImmutableNFANodeBuilder&lt;char, unsigned long&gt;::sinkTransitions(WebCore::ContentExtensions::ImmutableNFANode&amp;) (ImmutableNFANodeBuilder.h:198)
==444078==    by 0xA1136C9: finalize (ImmutableNFANodeBuilder.h:176)
==444078==    by 0xA1136C9: WebCore::ContentExtensions::ImmutableNFANodeBuilder&lt;char, unsigned long&gt;::~ImmutableNFANodeBuilder() (ImmutableNFANodeBuilder.h:71)
==444078==    by 0xA112E39: generateSuffixWithReverseSuffixTree (Source/WebCore/contentextensions/CombinedURLFilters.cpp:301)
==444078==    by 0xA112E39: generateNFAForSubtree (Source/WebCore/contentextensions/CombinedURLFilters.cpp:381)
==444078==    by 0xA112E39: WebCore::ContentExtensions::CombinedURLFilters::processNFAs(unsigned long, WTF::Function&lt;bool (WebCore::ContentExtensions::NFA&amp;&amp;)&gt;&amp;&amp;) (Source/WebCore/contentextensions/CombinedURLFilters.cpp:442)
==444078==    by 0xA11CEA9: compileToBytecode&lt;(lambda at /home/mcatanzaro/Projects/WebKit/Source/WebCore/contentextensions/ContentExtensionCompiler.cpp:397:90)&gt; (Source/WebCore/contentextensions/ContentExtensionCompiler.cpp:240)
==444078==    by 0xA11CEA9: WebCore::ContentExtensions::compileRuleList(WebCore::ContentExtensions::ContentExtensionCompilationClient&amp;, WTF::String&amp;&amp;, WTF::Vector&lt;WebCore::ContentExtensions::ContentExtensionRule, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt;&amp;&amp;) (Source/WebCore/contentextensions/ContentExtensionCompiler.cpp:397)
==444078==    by 0x8BEE8F8: compiledToFile (Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp:416)
==444078==    by 0x8BEE8F8: operator() (Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp:618)
==444078==    by 0x8BEE8F8: WTF::Detail::CallableWrapper&lt;API::ContentRuleListStore::compileContentRuleListFile(WTF::String&amp;&amp;, WTF::String&amp;&amp;, WTF::String&amp;&amp;, WebCore::ContentExtensions::CSSSelectorsAllowed, WTF::CompletionHandler&lt;void (WTF::RefPtr&lt;API::ContentRuleList, WTF::RawPtrTraits&lt;API::ContentRuleList&gt;, WTF::DefaultRefDerefTraits&lt;API::ContentRuleList&gt; &gt;, std::error_code)&gt;)::$_0, void&gt;::call() (Function.h:59)
==444078==    by 0xDECF804: operator() (Source/WTF/wtf/Function.h:103)
==444078==    by 0xDECF804: WTF::RunLoop::performWork() (Source/WTF/wtf/RunLoop.cpp:145)
==444078==    by 0xDF949E8: operator() (Source/WTF/wtf/glib/RunLoopGLib.cpp:153)
==444078==    by 0xDF949E8: WTF::RunLoop::RunLoop()::$_0::__invoke(void*) (Source/WTF/wtf/glib/RunLoopGLib.cpp:152)
==444078==    by 0xDF93328: operator() (Source/WTF/wtf/glib/RunLoopGLib.cpp:116)
==444078==    by 0xDF93328: WTF::RunLoop::$_3::__invoke(_GSource*, int (*)(void*), void*) (Source/WTF/wtf/glib/RunLoopGLib.cpp:89)
==444078==    by 0x4D6D62B: g_main_dispatch (gmain.c:3591)
==444078==  Uninitialised value was created by a stack allocation
==444078==    at 0xA128D00: WebCore::ContentExtensions::ImmutableNFANodeBuilder&lt;char, unsigned long&gt;::sinkTransitions(WebCore::ContentExtensions::ImmutableNFANode&amp;) (ImmutableNFANodeBuilder.h:190)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2202872</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2026-04-21 12:22:11 -0700</bug_when>
    <thetext>&lt;rdar://problem/175273937&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2206516</commentid>
    <comment_count>2</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2026-05-01 00:57:10 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/64034</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2206555</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-05-01 06:24:17 -0700</bug_when>
    <thetext>Committed 312425@main (07918cccab88): &lt;https://commits.webkit.org/312425@main&gt;

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

    </bug>

</bugzilla>