Title: [280211] trunk/Source/WebCore
- Revision
- 280211
- Author
- [email protected]
- Date
- 2021-07-22 17:09:31 -0700 (Thu, 22 Jul 2021)
Log Message
The network process fails to take a locked file assertion when executing a SQLiteStatement outside a transaction
https://bugs.webkit.org/show_bug.cgi?id=228194
Reviewed by Geoffrey Garen.
The network process fails to take a locked file assertion when executing a SQLiteStatement outside a transaction.
This means we may suspend in the middle of that statement and crash due to holding locked files.
To address this, we now make sure to bump the transaction count during the sqlite3_step() call if we're not
in the middle of a transaction and the current statement is not read-only (e.g. SELECT). Note that SQLite will
implicitly create a transaction for us in such cases.
* platform/sql/SQLiteStatement.cpp:
(WebCore::SQLiteStatement::step):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (280210 => 280211)
--- trunk/Source/WebCore/ChangeLog 2021-07-23 00:08:14 UTC (rev 280210)
+++ trunk/Source/WebCore/ChangeLog 2021-07-23 00:09:31 UTC (rev 280211)
@@ -1,3 +1,20 @@
+2021-07-22 Chris Dumez <[email protected]>
+
+ The network process fails to take a locked file assertion when executing a SQLiteStatement outside a transaction
+ https://bugs.webkit.org/show_bug.cgi?id=228194
+
+ Reviewed by Geoffrey Garen.
+
+ The network process fails to take a locked file assertion when executing a SQLiteStatement outside a transaction.
+ This means we may suspend in the middle of that statement and crash due to holding locked files.
+
+ To address this, we now make sure to bump the transaction count during the sqlite3_step() call if we're not
+ in the middle of a transaction and the current statement is not read-only (e.g. SELECT). Note that SQLite will
+ implicitly create a transaction for us in such cases.
+
+ * platform/sql/SQLiteStatement.cpp:
+ (WebCore::SQLiteStatement::step):
+
2021-07-22 Myles C. Maxfield <[email protected]>
[Cocoa] ".SF Arabic" should not be able to be looked up by name (because it is dot-prefixed)
Modified: trunk/Source/WebCore/platform/sql/SQLiteStatement.cpp (280210 => 280211)
--- trunk/Source/WebCore/platform/sql/SQLiteStatement.cpp 2021-07-23 00:08:14 UTC (rev 280210)
+++ trunk/Source/WebCore/platform/sql/SQLiteStatement.cpp 2021-07-23 00:09:31 UTC (rev 280211)
@@ -28,6 +28,7 @@
#include "Logging.h"
#include "SQLValue.h"
+#include "SQLiteDatabaseTracker.h"
#include <sqlite3.h>
#include <wtf/Assertions.h>
#include <wtf/Variant.h>
@@ -66,6 +67,12 @@
{
Locker databaseLock { m_database.databaseMutex() };
+ // If we're not within a transaction and we call sqlite3_step(), SQLite will implicitly create a transaction for us.
+ // In such case, we should bump our transaction count to reflect that.
+ std::optional<SQLiteTransactionInProgressAutoCounter> transactionCounter;
+ if (!m_database.transactionInProgress() && !isReadOnly())
+ transactionCounter.emplace();
+
int error = sqlite3_step(m_statement);
if (error != SQLITE_DONE && error != SQLITE_ROW)
LOG(SQLDatabase, "sqlite3_step failed (%i)\nError - %s", error, sqlite3_errmsg(m_database.sqlite3Handle()));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes