Title: [249053] branches/safari-608-branch/Source/WebCore
Revision
249053
Author
[email protected]
Date
2019-08-23 10:53:14 -0700 (Fri, 23 Aug 2019)

Log Message

Cherry-pick r248967. rdar://problem/54643456

    Crash under StringImpl::endsWith() in RegistrationDatabase::openSQLiteDatabase()
    https://bugs.webkit.org/show_bug.cgi?id=200991
    <rdar://problem/54566689>

    Reviewed by Geoffrey Garen.

    Make sure we call isolatedCopy() on RegistrationDatabase::m_databaseDirectory before using
    it from background threads.

    * workers/service/server/RegistrationDatabase.cpp:
    (WebCore::RegistrationDatabase::openSQLiteDatabase):
    (WebCore::RegistrationDatabase::clearAll):
    * workers/service/server/RegistrationDatabase.h:
    (WebCore::RegistrationDatabase::databaseDirectory const):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248967 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-608-branch/Source/WebCore/ChangeLog (249052 => 249053)


--- branches/safari-608-branch/Source/WebCore/ChangeLog	2019-08-23 17:21:19 UTC (rev 249052)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog	2019-08-23 17:53:14 UTC (rev 249053)
@@ -1,3 +1,42 @@
+2019-08-23  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r248967. rdar://problem/54643456
+
+    Crash under StringImpl::endsWith() in RegistrationDatabase::openSQLiteDatabase()
+    https://bugs.webkit.org/show_bug.cgi?id=200991
+    <rdar://problem/54566689>
+    
+    Reviewed by Geoffrey Garen.
+    
+    Make sure we call isolatedCopy() on RegistrationDatabase::m_databaseDirectory before using
+    it from background threads.
+    
+    * workers/service/server/RegistrationDatabase.cpp:
+    (WebCore::RegistrationDatabase::openSQLiteDatabase):
+    (WebCore::RegistrationDatabase::clearAll):
+    * workers/service/server/RegistrationDatabase.h:
+    (WebCore::RegistrationDatabase::databaseDirectory const):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248967 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-08-21  Chris Dumez  <[email protected]>
+
+            Crash under StringImpl::endsWith() in RegistrationDatabase::openSQLiteDatabase()
+            https://bugs.webkit.org/show_bug.cgi?id=200991
+            <rdar://problem/54566689>
+
+            Reviewed by Geoffrey Garen.
+
+            Make sure we call isolatedCopy() on RegistrationDatabase::m_databaseDirectory before using
+            it from background threads.
+
+            * workers/service/server/RegistrationDatabase.cpp:
+            (WebCore::RegistrationDatabase::openSQLiteDatabase):
+            (WebCore::RegistrationDatabase::clearAll):
+            * workers/service/server/RegistrationDatabase.h:
+            (WebCore::RegistrationDatabase::databaseDirectory const):
+
 2019-08-22  Kocsen Chung  <[email protected]>
 
         Cherry-pick r249006. rdar://problem/54600921

Modified: branches/safari-608-branch/Source/WebCore/workers/service/server/RegistrationDatabase.cpp (249052 => 249053)


--- branches/safari-608-branch/Source/WebCore/workers/service/server/RegistrationDatabase.cpp	2019-08-23 17:21:19 UTC (rev 249052)
+++ branches/safari-608-branch/Source/WebCore/workers/service/server/RegistrationDatabase.cpp	2019-08-23 17:53:14 UTC (rev 249053)
@@ -130,7 +130,8 @@
     ASSERT(!isMainThread());
     ASSERT(!m_database);
 
-    cleanOldDatabases(m_databaseDirectory);
+    auto databaseDirectory = this->databaseDirectory();
+    cleanOldDatabases(databaseDirectory);
 
     LOG(ServiceWorker, "ServiceWorker RegistrationDatabase opening file %s", fullFilename.utf8().data());
 
@@ -150,7 +151,7 @@
         });
     });
 
-    SQLiteFileSystem::ensureDatabaseDirectoryExists(m_databaseDirectory);
+    SQLiteFileSystem::ensureDatabaseDirectoryExists(databaseDirectory);
 
     m_database = std::make_unique<SQLiteDatabase>();
     if (!m_database->open(fullFilename)) {
@@ -299,7 +300,7 @@
         m_database = nullptr;
 
         SQLiteFileSystem::deleteDatabaseFile(m_databaseFilePath);
-        SQLiteFileSystem::deleteEmptyDatabaseDirectory(m_databaseDirectory);
+        SQLiteFileSystem::deleteEmptyDatabaseDirectory(databaseDirectory());
 
         callOnMainThread(WTFMove(completionHandler));
     });

Modified: branches/safari-608-branch/Source/WebCore/workers/service/server/RegistrationDatabase.h (249052 => 249053)


--- branches/safari-608-branch/Source/WebCore/workers/service/server/RegistrationDatabase.h	2019-08-23 17:21:19 UTC (rev 249052)
+++ branches/safari-608-branch/Source/WebCore/workers/service/server/RegistrationDatabase.h	2019-08-23 17:53:14 UTC (rev 249053)
@@ -59,6 +59,8 @@
 
 private:
     RegistrationDatabase(RegistrationStore&, String&& databaseDirectory);
+    
+    String databaseDirectory() const { return m_databaseDirectory.isolatedCopy(); }
 
     void postTaskToWorkQueue(Function<void()>&&);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to