<?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>305864</bug_id>
          
          <creation_ts>2026-01-20 12:05:51 -0800</creation_ts>
          <short_desc>[CSS] Crash due to release assert in HashTable when MatchedDeclarationsCache::computeHash() returns 0xFFFFFFFF</short_desc>
          <delta_ts>2026-01-21 21:24:17 -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>CSS</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=295927</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>232930</dependson>
    
    <dependson>267447</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="David Kilzer (:ddkilzer)">ddkilzer</reporter>
          <assigned_to name="David Kilzer (:ddkilzer)">ddkilzer</assigned_to>
          <cc>koivisto</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2173421</commentid>
    <comment_count>0</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2026-01-20 12:05:51 -0800</bug_when>
    <thetext>The computeHash() function in Source/WebCore/style/MatchedDeclarationsCache.cpp returns the result of WTF::computeHash() directly without calling AlreadyHashed::avoidDeletedValue().

The call chain is:
  WTF::computeHash() -&gt; SuperFastHash::hash() -&gt; StringHasher::finalize() -&gt; avoidZero(avalancheBits(hash))

The avalancheBits() function can return the full range of 32-bit values, including 0xFFFFFFFF. While avoidZero() prevents returning 0 (the empty sentinel), it does not prevent returning 0xFFFFFFFF (the deleted sentinel for unsigned hash keys).

When the hash value equals 0xFFFFFFFF and is inserted into HashMap&lt;unsigned, ..., AlreadyHashed&gt;, it triggers RELEASE_ASSERT in checkHashTableKey().

This bug is not testable because the hash includes pointer values that vary at runtime:

```
// MatchedDeclarationsCache.cpp:137
unsigned hash = WTF::computeHash(matchResult, &amp;inheritedCustomProperties);
//                                            ^^^ pointer value

// MatchResult.h:120-121
add(hasher,
    matchedProperties.properties.ptr(),  // &lt;-- pointer value
    matchedProperties.linkMatchType,
    ...
);
```

Crash stack:
```
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread:
0   WebCore  WTFCrashWithInfo + 24 (Assertions.h:969)
1   WebCore  void WTF::checkHashTableKey&lt;...&gt; + 24 (HashTable.h:374)
2   WebCore  WTF::HashTable&lt;...&gt;::inlineLookup&lt;...&gt; + 24 (HashTable.h:670)
3   WebCore  WTF::HashTable&lt;...&gt;::lookup&lt;...&gt; + 24 (HashTable.h:662)
4   WebCore  WTF::HashTable&lt;...&gt;::find&lt;...&gt; + 48 (HashTable.h:1004)
5   WebCore  WTF::HashTable&lt;...&gt;::find&lt;...&gt; + 48 (HashTable.h:515)
6   WebCore  WTF::HashMap&lt;...&gt;::find + 48 (HashMap.h:360)
7   WebCore  WebCore::Style::MatchedDeclarationsCache::find + 48 (MatchedDeclarationsCache.cpp:143)
8   WebCore  WebCore::Style::Resolver::applyMatchedProperties + 1284 (StyleResolver.cpp:706)
9   WebCore  WebCore::Style::Resolver::unadjustedStyleForElement + 3532 (StyleResolver.cpp:341)
10  WebCore  WebCore::SVGElement::resolveCustomStyle + 44 (SVGElement.cpp:647)
[...]
```

&lt;rdar://118164567&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2173422</commentid>
    <comment_count>1</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2026-01-20 12:05:54 -0800</bug_when>
    <thetext>The fix is to wrap the return value with AlreadyHashed::avoidDeletedValue() to transform 0xFFFFFFFF to 0x7FFFFFFF:

```
return AlreadyHashed::avoidDeletedValue(WTF::computeHash(matchResult, &amp;inheritedCustomProperties));
```

This follows the existing pattern in SharedStringHash.cpp and ImmutableStyleProperties.cpp.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2173452</commentid>
    <comment_count>2</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2026-01-20 13:36:58 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/56925</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2173979</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-01-21 21:24:15 -0800</bug_when>
    <thetext>Committed 305989@main (45684cc85f9f): &lt;https://commits.webkit.org/305989@main&gt;

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

    </bug>

</bugzilla>