summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-07 20:56:31 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-07 20:56:31 +0000
commit92c6fc387d81ca52bd5d6cd7a87c0b0c3b792a3f (patch)
tree0bc7dd42cfa56b00b3c217014dd1d564bb137660 /net
parent1d1ad2d286859020e6ffa6dea89ed79d3a3bae6a (diff)
downloadchromium_src-92c6fc387d81ca52bd5d6cd7a87c0b0c3b792a3f.zip
chromium_src-92c6fc387d81ca52bd5d6cd7a87c0b0c3b792a3f.tar.gz
chromium_src-92c6fc387d81ca52bd5d6cd7a87c0b0c3b792a3f.tar.bz2
Revert "Check blockfile size before attempting to read the header."
The unittest isn't liked by windows. This reverts commit c0be0e8cda2bfe9c1eccb662ccdad9a2b7768132. TBR=rvargas Review URL: http://codereview.chromium.org/165157 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22786 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/disk_cache/block_files.cc6
-rw-r--r--net/disk_cache/block_files_unittest.cc20
2 files changed, 0 insertions, 26 deletions
diff --git a/net/disk_cache/block_files.cc b/net/disk_cache/block_files.cc
index 0e9eb04..cd7e5cf 100644
--- a/net/disk_cache/block_files.cc
+++ b/net/disk_cache/block_files.cc
@@ -247,12 +247,6 @@ bool BlockFiles::OpenBlockFile(int index) {
return false;
}
- if (file->GetLength() < static_cast<size_t>(kBlockHeaderSize)) {
- LOG(ERROR) << "File too small " << name;
- file->Release();
- return false;
- }
-
block_files_[index] = file;
BlockFileHeader* header = reinterpret_cast<BlockFileHeader*>(file->buffer());
diff --git a/net/disk_cache/block_files_unittest.cc b/net/disk_cache/block_files_unittest.cc
index e3ca651..b4ce107 100644
--- a/net/disk_cache/block_files_unittest.cc
+++ b/net/disk_cache/block_files_unittest.cc
@@ -153,23 +153,3 @@ TEST_F(DiskCacheTest, BlockFiles_Recover) {
EXPECT_EQ(empty_3, header->empty[2]);
EXPECT_EQ(empty_4, header->empty[3]);
}
-
-// Handling of truncated files.
-TEST_F(DiskCacheTest, BlockFiles_ZeroSizeFile) {
- std::wstring path = GetCachePath();
- ASSERT_TRUE(DeleteCache(path.c_str()));
- ASSERT_TRUE(file_util::CreateDirectory(path));
-
- disk_cache::BlockFiles files(path);
- ASSERT_TRUE(files.Init(true));
-
- // Truncate one of the files.
- disk_cache::Addr address;
- EXPECT_TRUE(files.CreateBlock(disk_cache::RANKINGS, 4, &address));
- disk_cache::MappedFile* file = files.GetFile(address);
- file->SetLength(0);
- files.CloseFiles();
-
- // Initializing should fail, not crash.
- ASSERT_FALSE(files.Init(false));
-}