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

Unified Diff: net/disk_cache/backend_impl.cc

Issue 20054: Disk cache: Add a check to make sure that the index table mask is not bigger ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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 | net/disk_cache/errors.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/backend_impl.cc
===================================================================
--- net/disk_cache/backend_impl.cc (revision 9104)
+++ net/disk_cache/backend_impl.cc (working copy)
@@ -846,6 +846,9 @@
rankings_.Reset();
init_ = false;
restarted_ = true;
+
+ // TODO(rvargas): remove this line at the end of this experiment.
+ max_size_ = 0;
}
int BackendImpl::NewEntry(Addr address, EntryImpl** entry, bool* dirty) {
@@ -1093,7 +1096,7 @@
}
AdjustMaxCacheSize(data_->header.table_len);
-
+
// We need to avoid integer overflows.
DCHECK(max_size_ < kint32max - kint32max / 10);
if (data_->header.num_bytes < 0 ||
@@ -1110,6 +1113,14 @@
if (!mask_)
mask_ = data_->header.table_len - 1;
+ // TODO(rvargas): remove this. For some reason, we are receiving crashes with
+ // mask_ being bigger than the actual table length. (bug 7217).
+ if (mask_ > 0xffff) {
+ LOG(ERROR) << "Invalid cache mask";
+ ReportError(ERR_INVALID_MASK);
+ return false;
+ }
+
return true;
}
« no previous file with comments | « no previous file | net/disk_cache/errors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698