Title: [248967] trunk/Source/WebCore
Revision
248967
Author
cdu...@apple.com
Date
2019-08-21 15:17:49 -0700 (Wed, 21 Aug 2019)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (248966 => 248967)


--- trunk/Source/WebCore/ChangeLog	2019-08-21 22:03:02 UTC (rev 248966)
+++ trunk/Source/WebCore/ChangeLog	2019-08-21 22:17:49 UTC (rev 248967)
@@ -1,3 +1,20 @@
+2019-08-21  Chris Dumez  <cdu...@apple.com>
+
+        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-21  Alex Christensen  <achristen...@webkit.org>
 
         Disabling text autosizing should prevent text autosizing

Modified: trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp (248966 => 248967)


--- trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp	2019-08-21 22:03:02 UTC (rev 248966)
+++ trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp	2019-08-21 22:17:49 UTC (rev 248967)
@@ -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 = makeUnique<SQLiteDatabase>();
     if (!m_database->open(fullFilename)) {
@@ -308,7 +309,7 @@
         m_database = nullptr;
 
         SQLiteFileSystem::deleteDatabaseFile(m_databaseFilePath);
-        SQLiteFileSystem::deleteEmptyDatabaseDirectory(m_databaseDirectory);
+        SQLiteFileSystem::deleteEmptyDatabaseDirectory(databaseDirectory());
 
         callOnMainThread(WTFMove(completionHandler));
     });

Modified: trunk/Source/WebCore/workers/service/server/RegistrationDatabase.h (248966 => 248967)


--- trunk/Source/WebCore/workers/service/server/RegistrationDatabase.h	2019-08-21 22:03:02 UTC (rev 248966)
+++ trunk/Source/WebCore/workers/service/server/RegistrationDatabase.h	2019-08-21 22:17:49 UTC (rev 248967)
@@ -59,6 +59,8 @@
 
 private:
     RegistrationDatabase(RegistrationStore&, String&& databaseDirectory);
+    
+    String databaseDirectory() const { return m_databaseDirectory.isolatedCopy(); }
 
     void postTaskToWorkQueue(Function<void()>&&);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to