Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: sql/connection.cc

Issue 1657593005: [sql] Prevent recovery against a closed database. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Detect API mis-use. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sql/recovery.cc » ('j') | sql/recovery_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sql/connection.cc
diff --git a/sql/connection.cc b/sql/connection.cc
index 003005a8e6294247df3d5bbea887a54ccd365cd7..9f7eb2bcdcdb29fd981ea45127993dda0de88d18 100644
--- a/sql/connection.cc
+++ b/sql/connection.cc
@@ -260,7 +260,15 @@ void Connection::ReportDiagnosticInfo(int extended_error, Statement* stmt) {
std::string debug_info;
const int error = (extended_error & 0xFF);
if (error == SQLITE_CORRUPT) {
+ // CollectCorruptionInfo() is implemented in terms of sql::Connection,
+ // prevent reentrant calls to the error callback.
+ // TODO(shess): Rewrite IntegrityCheckHelper() in terms of raw SQLite.
+ ErrorCallback original_callback = std::move(error_callback_);
+ reset_error_callback();
+
debug_info = CollectCorruptionInfo();
+
+ error_callback_ = std::move(original_callback);
} else {
debug_info = CollectErrorInfo(extended_error, stmt);
}
« no previous file with comments | « no previous file | sql/recovery.cc » ('j') | sql/recovery_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698