Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 313a4e84e9cc3044d9d5587e807074d0d6240dc1
      
https://github.com/WebKit/WebKit/commit/313a4e84e9cc3044d9d5587e807074d0d6240dc1
  Author: David Kilzer <[email protected]>
  Date:   2026-08-19 (Wed, 19 Aug 2026)

  Changed paths:
    M Source/WebKit/WebProcess/WebStorage/WebStorageNamespaceProvider.cpp

  Log Message:
  -----------
  REGRESSION (259876@main): Check for end iterator in 
WebStorageNamespaceProvider::decrementUseCount()
<https://bugs.webkit.org/show_bug.cgi?id=317082>
<rdar://179209792>

Reviewed by Zak Ridouh.

Guard against a missing entry before dereferencing the result of
`HashMap::find()` in `decrementUseCount()`.  The function relies on
`ASSERT(iterator != ...end())`, which compiles to nothing in release
builds, then reads `iterator->value` unconditionally.  When the
identifier is absent, `find()` returns `end()`, and reading
`end()->value` accesses memory one entry past the table's backing
buffer.

The absent-entry case became reachable in 259876@main, which replaced
the page-group-keyed owning map of providers with a single weakly-held
provider (`existingStorageNameSpaceProvider()`).  The provider is now
destroyed when the last page in a Web Content process goes away and
recreated empty for the next page, so a `WebPage` torn down after that
point decrements against a provider that never held its identifier.

Return early when the iterator is `end()`, matching the existing guard
in the sibling accessor `sessionStorageNamespace()`.  The
`ASSERT(sessionStorageNamespaces.useCount)` is retained so debug builds
still flag a use-count imbalance.

No new tests since this path is reached only during web page teardown
when the session storage namespace entry has already been removed, and
is not directly testable through public API.

* Source/WebKit/WebProcess/WebStorage/WebStorageNamespaceProvider.cpp:
(WebKit::WebStorageNamespaceProvider::decrementUseCount):

Originally-landed-as: [email protected] (6254fe9499a7). 
rdar://184744974
Canonical link: https://commits.webkit.org/319447@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to