Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d9783c3c13e7b9da3ff3cdb8947022f377b20c62
https://github.com/WebKit/WebKit/commit/d9783c3c13e7b9da3ff3cdb8947022f377b20c62
Author: Chris Dumez <[email protected]>
Date: 2026-06-30 (Tue, 30 Jun 2026)
Changed paths:
M Source/WebKit/UIProcess/Extensions/API/WebExtensionContextAPIStorage.cpp
Log Message:
-----------
[WebKit Process Model] Use-after-free in WebExtensionContext::storageSet from
HashMap mutation during keys() iteration
https://bugs.webkit.org/show_bug.cgi?id=315538
rdar://177375129
Reviewed by Timothy Hatcher.
When WebExtensionStorageSQLiteStore::setKeyedData hits an INSERT error
mid-batch (e.g. SQLITE_FULL), it returns a keysSuccessfullySet vector
that is non-empty but smaller than the input map. The completion lambda
in storageSet then iterated `data.keys()` while calling `data.remove()`
inside the loop. `keys()` returns a live iterator range backed by raw
pointers into the HashTable buffer, and remove() can shrink/rehash and
free that buffer, leaving the iterator dangling — a heap UAF in the UI
Process driven by IPC from the WebContent process.
Replace the iterate-and-mutate loop with HashMap::removeIf, which walks
the table safely.
* Source/WebKit/UIProcess/Extensions/API/WebExtensionContextAPIStorage.cpp:
(WebKit::WebExtensionContext::storageSet):
Originally-landed-as: 305413.961@safari-7624-branch (de9fb008197a).
rdar://180427449
Canonical link: https://commits.webkit.org/316136@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications