Index: net/disk_cache/simple/simple_synchronous_entry.cc |
diff --git a/net/disk_cache/simple/simple_synchronous_entry.cc b/net/disk_cache/simple/simple_synchronous_entry.cc |
index 2b4673c2384d29ff8082a912c0c441404daca107..dc27812c71382e95de0430d79a699a080174899d 100644 |
--- a/net/disk_cache/simple/simple_synchronous_entry.cc |
+++ b/net/disk_cache/simple/simple_synchronous_entry.cc |
@@ -43,7 +43,8 @@ enum OpenEntryResult { |
OPEN_ENTRY_KEY_MISMATCH = 6, |
OPEN_ENTRY_KEY_HASH_MISMATCH = 7, |
OPEN_ENTRY_SPARSE_OPEN_FAILED = 8, |
- OPEN_ENTRY_MAX = 9, |
+ OPEN_ENTRY_INVALID_FILE_LENGTH = 9, |
+ OPEN_ENTRY_MAX = 10, |
}; |
// Used in histograms, please only add entries at the end. |
@@ -951,6 +952,11 @@ bool SimpleSynchronousEntry::OpenFiles(SimpleEntryStat* out_entry_stat) { |
// 0, stream 1 and one EOF record. The exact distribution of sizes between |
// stream 1 and stream 0 is only determined after reading the EOF record |
// for stream 0 in ReadAndValidateStream0. |
+ if (!base::IsValueInRangeForNumericType<int>(file_info.size)) { |
+ RecordSyncOpenResult(cache_type_, OPEN_ENTRY_INVALID_FILE_LENGTH, |
+ had_index_); |
+ return false; |
+ } |
out_entry_stat->set_data_size(i + 1, static_cast<int>(file_info.size)); |
} |
SIMPLE_CACHE_UMA(CUSTOM_COUNTS, |