[Webkit-unassigned] [Bug 185873] [Curl] Not all Cookie database files are deleted on corruption

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 17 22:26:25 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=185873

Fujii Hironori <Hironori.Fujii at sony.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Hironori.Fujii at sony.com
 Attachment #341007|review?                     |review-
              Flags|                            |

--- Comment #4 from Fujii Hironori <Hironori.Fujii at sony.com> ---
Comment on attachment 341007
  --> https://bugs.webkit.org/attachment.cgi?id=341007
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=341007&action=review

> Source/WebCore/platform/network/curl/CookieJarDB.cpp:222
> +        return true;

Should this be a following code?
if (resultCode != SQLITE_OK)
    return false;

> Source/WebCore/platform/network/curl/CookieJarDB.cpp:249
> +    FileSystem::deleteFile(m_databasePath + "-shm");

Why do you need to do 'deleteFile(m_databasePath + "-shm")' twice?

> Source/WebCore/platform/network/curl/CookieJarDB.cpp:510
> +

You use checkSQLiteReturnCode in ASSERT macro even though it has a side effect.
The side effect is effective only in Debug build.
Is this intentional?

checkSQLiteReturnCode should be defined as:

void CookieJarDB::checkSQLiteReturnCode(int actual)
{
    if (!m_detectedDatabaseCorruption) {
        switch (actual) {
        case SQLITE_CORRUPT:
        case SQLITE_SCHEMA:
        case SQLITE_FORMAT:
        case SQLITE_NOTADB:
            flagDatabaseCorruption();
            m_detectedDatabaseCorruption = true;
        }
    }
}

This code should be replaced with:

checkSQLiteReturnCode(ret);
if (ret != SQLITE_OK && ret != SQLITE_DONE && ret != SQLITE_ROW && !ignoreError)
    LOG_ERROR("Failed to execute %s error: %s", sql, m_database.lastErrorMsg());

Other ASSERT(checkSQLiteReturnCode(ret, SQLITE_DONE)) should be replaced with a following code:

checkSQLiteReturnCode(ret);
ASSERT(ret == SQLITE_DONE);

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180718/62cac89d/attachment.html>


More information about the webkit-unassigned mailing list