Changeset 248967 in webkit


Ignore:
Timestamp:
Aug 21, 2019 3:17:49 PM (5 years ago)
Author:
Chris Dumez
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):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r248966 r248967  
     12019-08-21  Chris Dumez  <cdumez@apple.com>
     2
     3        Crash under StringImpl::endsWith() in RegistrationDatabase::openSQLiteDatabase()
     4        https://bugs.webkit.org/show_bug.cgi?id=200991
     5        <rdar://problem/54566689>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        Make sure we call isolatedCopy() on RegistrationDatabase::m_databaseDirectory before using
     10        it from background threads.
     11
     12        * workers/service/server/RegistrationDatabase.cpp:
     13        (WebCore::RegistrationDatabase::openSQLiteDatabase):
     14        (WebCore::RegistrationDatabase::clearAll):
     15        * workers/service/server/RegistrationDatabase.h:
     16        (WebCore::RegistrationDatabase::databaseDirectory const):
     17
    1182019-08-21  Alex Christensen  <achristensen@webkit.org>
    219
  • trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp

    r248846 r248967  
    131131    ASSERT(!m_database);
    132132
    133     cleanOldDatabases(m_databaseDirectory);
     133    auto databaseDirectory = this->databaseDirectory();
     134    cleanOldDatabases(databaseDirectory);
    134135
    135136    LOG(ServiceWorker, "ServiceWorker RegistrationDatabase opening file %s", fullFilename.utf8().data());
     
    151152    });
    152153
    153     SQLiteFileSystem::ensureDatabaseDirectoryExists(m_databaseDirectory);
     154    SQLiteFileSystem::ensureDatabaseDirectoryExists(databaseDirectory);
    154155
    155156    m_database = makeUnique<SQLiteDatabase>();
     
    309310
    310311        SQLiteFileSystem::deleteDatabaseFile(m_databaseFilePath);
    311         SQLiteFileSystem::deleteEmptyDatabaseDirectory(m_databaseDirectory);
     312        SQLiteFileSystem::deleteEmptyDatabaseDirectory(databaseDirectory());
    312313
    313314        callOnMainThread(WTFMove(completionHandler));
  • trunk/Source/WebCore/workers/service/server/RegistrationDatabase.h

    r248668 r248967  
    6060private:
    6161    RegistrationDatabase(RegistrationStore&, String&& databaseDirectory);
     62   
     63    String databaseDirectory() const { return m_databaseDirectory.isolatedCopy(); }
    6264
    6365    void postTaskToWorkQueue(Function<void()>&&);
Note: See TracChangeset for help on using the changeset viewer.