| Index: net/disk_cache/flash/segment.cc
|
| diff --git a/net/disk_cache/flash/segment.cc b/net/disk_cache/flash/segment.cc
|
| index a63a5a39985d077b7eca9393321204e57eddfa0f..a0d277fe8aa5fbdb0f7cd7ac883cc1c798f2df38 100644
|
| --- a/net/disk_cache/flash/segment.cc
|
| +++ b/net/disk_cache/flash/segment.cc
|
| @@ -18,17 +18,19 @@ Segment::Segment(int32 index, bool read_only, Storage* storage)
|
| write_offset_(offset_) {
|
| DCHECK(storage);
|
| DCHECK(storage->size() % kFlashSegmentSize == 0);
|
| - DCHECK(offset_ >= 0 && offset_ + kFlashSegmentSize <= storage->size());
|
| }
|
|
|
| Segment::~Segment() {
|
| - DCHECK(read_only_);
|
| + DCHECK(!init_ || read_only_);
|
| }
|
|
|
| bool Segment::Init() {
|
| if (init_)
|
| return false;
|
|
|
| + if (offset_ < 0 || offset_ + kFlashSegmentSize > storage_->size())
|
| + return false;
|
| +
|
| if (!read_only_) {
|
| init_ = true;
|
| return true;
|
|
|