summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/disk_cache/backend_impl.cc13
-rw-r--r--net/disk_cache/errors.h3
2 files changed, 14 insertions, 2 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 4698754..5fbb390 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -846,6 +846,9 @@ void BackendImpl::PrepareForRestart() {
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 @@ bool BackendImpl::CheckIndex() {
}
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 @@ bool BackendImpl::CheckIndex() {
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;
}
diff --git a/net/disk_cache/errors.h b/net/disk_cache/errors.h
index eea087a..991086f 100644
--- a/net/disk_cache/errors.h
+++ b/net/disk_cache/errors.h
@@ -21,7 +21,8 @@ enum {
ERR_NUM_ENTRIES_MISMATCH = -9,
ERR_READ_FAILURE = -10,
ERR_PREVIOUS_CRASH = -11,
- ERR_STORAGE_ERROR = -12
+ ERR_STORAGE_ERROR = -12,
+ ERR_INVALID_MASK = -13
};
} // namespace disk_cache