summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/block_files.h
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-08 00:49:14 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-08 00:49:14 +0000
commit21fc9dc4cbe2c771e357f4dbed0d2b5131599f8a (patch)
tree48106c981d524a2c14557d3cb764789996af65c7 /net/disk_cache/block_files.h
parent11da7028425a758f1b30d19c802410747b4a98ad (diff)
downloadchromium_src-21fc9dc4cbe2c771e357f4dbed0d2b5131599f8a.zip
chromium_src-21fc9dc4cbe2c771e357f4dbed0d2b5131599f8a.tar.gz
chromium_src-21fc9dc4cbe2c771e357f4dbed0d2b5131599f8a.tar.bz2
Try again: Check blockfile size before attempting to read the header.
Reading past the last page of a mmapped file will SIGBUS. BUG=18174 TEST=truncate Default/Cache/data_* to zero bytes, launch chrome, try to load a website. It shouldn't crash. Review URL: http://codereview.chromium.org/165174 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22843 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/block_files.h')
-rw-r--r--net/disk_cache/block_files.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/disk_cache/block_files.h b/net/disk_cache/block_files.h
index 790cc7d..e86546e 100644
--- a/net/disk_cache/block_files.h
+++ b/net/disk_cache/block_files.h
@@ -11,6 +11,7 @@
#include "net/disk_cache/addr.h"
#include "net/disk_cache/mapped_file.h"
+#include "testing/gtest/include/gtest/gtest_prod.h"
namespace disk_cache {
@@ -75,6 +76,8 @@ class BlockFiles {
std::wstring path_; // Path to the backing folder.
std::vector<MappedFile*> block_files_; // The actual files.
+ FRIEND_TEST(DiskCacheTest, BlockFiles_ZeroSizeFile);
+
DISALLOW_EVIL_CONSTRUCTORS(BlockFiles);
};