[webkit-changes] [WebKit/WebKit] fa5d8d: Crash at API::getContentRuleListSourceFromMappedFi...
Timothy Hatcher
noreply at github.com
Tue Dec 3 17:34:48 PST 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: fa5d8d81450ba9d0a3f29ddc100b7f2e80c1420b
https://github.com/WebKit/WebKit/commit/fa5d8d81450ba9d0a3f29ddc100b7f2e80c1420b
Author: Timothy Hatcher <timothy at apple.com>
Date: 2024-12-03 (Tue, 03 Dec 2024)
Changed paths:
M Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp
M Source/WebKit/UIProcess/API/APIContentRuleListStore.h
M Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.mm
M Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h
M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKContentExtensionStore.mm
Log Message:
-----------
Crash at API::getContentRuleListSourceFromMappedFile().
https://webkit.org/b/283996
rdar://140450689
Reviewed by Alex Christensen.
Make the handling of getContentRuleListSourceFromMappedFile() more robust by checking header sizes
to the mapped data size. This was failing when the version got bumped and fallback to recompiling
from the original source was needed.
Improved mismatch version testing by dropping the version by one and keeping all the compiled data
the same to test proper version upgrades from the original source.
Added two corrupt size tests to error on invalid data sizes or empty data (missing source).
* Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp:
(API::getContentRuleListSourceFromMappedFile): Added logging and size checks.
(API::ContentRuleListStore::lookupContentRuleListFile): Check fileSize() against the mapped data.
(API::ContentRuleListStore::invalidateContentRuleListVersion): Changed to set the version back by one.
(API::ContentRuleListStore::corruptContentRuleListHeader): Added.
* Source/WebKit/UIProcess/API/APIContentRuleListStore.h:
* Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.mm:
(-[WKContentRuleListStore _corruptContentRuleListHeaderForIdentifier:usingCurrentVersion:]): Added.
* Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKContentExtensionStore.mm:
(TEST_F(WKContentRuleListStoreTest, VersionMismatch)): Updated expectations since source is preserved now.
(TEST_F(WKContentRuleListStoreTest, CorruptHeaderEmpty)): Added.
(TEST_F(WKContentRuleListStoreTest, CorruptHeaderRandom)): Added.
Canonical link: https://commits.webkit.org/287319@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list