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

Unified Diff: chrome/browser/history/history_backend.cc

Issue 23861005: Fix NULL deref in HistoryBackend::ExpireHistoryBetween. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/history_backend.cc
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc
index 1d63731625add0a46eee9e89b818996740e5122c..21ca31dcb8a8d34cc715678337ecb6414d50ad4b 100644
--- a/chrome/browser/history/history_backend.cc
+++ b/chrome/browser/history/history_backend.cc
@@ -710,6 +710,8 @@ void HistoryBackend::CloseAllDatabases() {
// Commit the long-running transaction.
db_->CommitTransaction();
db_.reset();
+ // Forget the first recorded time since the database is closed.
+ first_recorded_time_ = base::Time();
}
if (thumbnail_db_) {
thumbnail_db_->CommitTransaction();
@@ -2485,20 +2487,21 @@ void HistoryBackend::ExpireHistoryBetween(
const std::set<GURL>& restrict_urls,
Time begin_time,
Time end_time) {
- if (db_) {
- if (begin_time.is_null() && (end_time.is_null() || end_time.is_max()) &&
- restrict_urls.empty()) {
- // Special case deleting all history so it can be faster and to reduce the
- // possibility of an information leak.
- DeleteAllHistory();
- } else {
- // Clearing parts of history, have the expirer do the depend
- expirer_.ExpireHistoryBetween(restrict_urls, begin_time, end_time);
+ if (!db_)
+ return;
- // Force a commit, if the user is deleting something for privacy reasons,
- // we want to get it on disk ASAP.
- Commit();
- }
+ if (begin_time.is_null() && (end_time.is_null() || end_time.is_max()) &&
+ restrict_urls.empty()) {
+ // Special case deleting all history so it can be faster and to reduce the
+ // possibility of an information leak.
+ DeleteAllHistory();
+ } else {
+ // Clearing parts of history, have the expirer do the depend
+ expirer_.ExpireHistoryBetween(restrict_urls, begin_time, end_time);
+
+ // Force a commit, if the user is deleting something for privacy reasons,
+ // we want to get it on disk ASAP.
+ Commit();
}
if (begin_time <= first_recorded_time_)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698