[webkit-changes] [WebKit/WebKit] a7e290: WTF::computeHash() with RefPtr/CheckedPtr hashes t...

Antti Koivisto noreply at github.com
Mon Oct 9 10:27:26 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a7e29096ee4794aedf998e34529700719dc5f5a4
      https://github.com/WebKit/WebKit/commit/a7e29096ee4794aedf998e34529700719dc5f5a4
  Author: Antti Koivisto <antti at apple.com>
  Date:   2023-10-09 (Mon, 09 Oct 2023)

  Changed paths:
    M Source/WTF/wtf/Hasher.h
    M Tools/TestWebKitAPI/Tests/WTF/Hasher.cpp

  Log Message:
  -----------
  WTF::computeHash() with RefPtr/CheckedPtr hashes the result of implicit boolean conversion
https://bugs.webkit.org/show_bug.cgi?id=262891
rdar://116679372

Reviewed by Simon Fraser.

This can result in terrible hashing if the key contains RefPtrs, for example

using ResolverSharingKey = std::tuple<Vector<RefPtr<StyleSheetContents>>, bool, bool>;

in Style::Scope.

* Source/WTF/wtf/Hasher.h:
(WTF::add):

Add specializations for RefPtr and CheckedPtr so we don't hit the implicit boolean conversion.

* Tools/TestWebKitAPI/Tests/WTF/Hasher.cpp:
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/269081@main




More information about the webkit-changes mailing list