Skip to content

Conversation

@cdumez
Copy link
Contributor

@cdumez cdumez commented Jan 14, 2026

ea63bdf

New-Test(302373@main): ASSERTION FAILED: !(blobSize % sizeof(T)) on TestWebKitAPI.IndexedDB.OpenDatabaseWithMismatchedMetadataVersionAndName
https://bugs.webkit.org/show_bug.cgi?id=301776
rdar://163819252

Reviewed by NOBODY (OOPS!).

The test case is covering a case where the user has an IDB database whose
IDB version is 2 but is still using the old encoding for Strings (due to
a bug we had in WebKit for a while). In this case, it tries to read the
database name string in the new format and gets "garbage" and then later
compared it with the expected name and if it doesn't match, there is logic
to handle the migration. The issue is that there is a debug assertion in
sqliteColumnBlob() which hits in debug when trying to read the database
name in the new format (which doesn't match the format on disk). Since
this is expected in this case, I am replacing the debug assertion with
an `if` check which returns an empty span in this case (which is strictly
better than returning "garbage") and it will keep the database upgrade
logic working as intended.

Test: Tools/TestWebKitAPI/Tests/WebKitCocoa/IndexedDBFileName.mm

* Source/WebCore/platform/sql/SQLiteExtras.h:
(WebCore::sqliteColumnBlob):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/IndexedDBFileName.mm:
(TEST(IndexedDB, OpenDatabaseWithMismatchedMetadataVersionAndName)):

ea63bdf

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win ✅ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ✅ 🧪 win-tests loading 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe loading 🛠 vision-apple
✅ 🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 wpe-cairo-libwebrtc
✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🧪 vision-wk2 ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🛠 tv ✅ 🧪 mac-intel-wk2
✅ 🛠 tv-sim ✅ 🛠 mac-safer-cpp
✅ 🛠 watch
✅ 🛠 watch-sim

@cdumez cdumez self-assigned this Jan 14, 2026
@cdumez cdumez added the Website Storage Bugs related to storage APIs, including IndexedDB and localStorage label Jan 14, 2026
@cdumez cdumez requested a review from szewai January 14, 2026 07:22
@cdumez cdumez added the safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks label Jan 14, 2026
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jan 14, 2026
@cdumez cdumez removed the merging-blocked Applied to prevent a change from being merged label Jan 14, 2026
@cdumez cdumez force-pushed the 301776_IDB_Database_name_crash branch from ad6adbf to 74deb04 Compare January 14, 2026 10:16
@cdumez cdumez added safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks and removed safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks labels Jan 14, 2026
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jan 14, 2026
…estWebKitAPI.IndexedDB.OpenDatabaseWithMismatchedMetadataVersionAndName

https://bugs.webkit.org/show_bug.cgi?id=301776
rdar://163819252

Reviewed by NOBODY (OOPS!).

The test case is covering a case where the user has an IDB database whose
IDB version is 2 but is still using the old encoding for Strings (due to
a bug we had in WebKit for a while). In this case, it tries to read the
database name string in the new format and gets "garbage" and then later
compared it with the expected name and if it doesn't match, there is logic
to handle the migration. The issue is that there is a debug assertion in
sqliteColumnBlob() which hits in debug when trying to read the database
name in the new format (which doesn't match the format on disk). Since
this is expected in this case, I am replacing the debug assertion with
an `if` check which returns an empty span in this case (which is strictly
better than returning "garbage") and it will keep the database upgrade
logic working as intended.

Test: Tools/TestWebKitAPI/Tests/WebKitCocoa/IndexedDBFileName.mm

* Source/WebCore/platform/sql/SQLiteExtras.h:
(WebCore::sqliteColumnBlob):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/IndexedDBFileName.mm:
(TEST(IndexedDB, OpenDatabaseWithMismatchedMetadataVersionAndName)):
@cdumez cdumez removed the merging-blocked Applied to prevent a change from being merged label Jan 14, 2026
@cdumez cdumez force-pushed the 301776_IDB_Database_name_crash branch from 74deb04 to ea63bdf Compare January 14, 2026 11:42
@cdumez cdumez added safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks and removed safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks labels Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks Website Storage Bugs related to storage APIs, including IndexedDB and localStorage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants