Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Unified Diff: chrome/utility/safe_browsing/mac/udif.cc

Issue 2202343004: [Mac] Convert a DCHECK to a condition in safe_browsing::dmg::UDIFBlockChunkReadStream::Seek. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/utility/safe_browsing/mac/udif.cc
diff --git a/chrome/utility/safe_browsing/mac/udif.cc b/chrome/utility/safe_browsing/mac/udif.cc
index f91b8b168b6621b4615465f69835a61aaa31ec22..9a48efa50023474d0912d0cc2bc151048be8d1e9 100644
--- a/chrome/utility/safe_browsing/mac/udif.cc
+++ b/chrome/utility/safe_browsing/mac/udif.cc
@@ -654,7 +654,8 @@ off_t UDIFPartitionReadStream::Seek(off_t offset, int whence) {
new UDIFBlockChunkReadStream(stream_, block_size_, chunk));
}
current_chunk_ = chunk_number;
- chunk_stream_->Seek(decompress_read_offset.ValueOrDie(), SEEK_SET);
+ if (chunk_stream_->Seek(decompress_read_offset.ValueOrDie(), SEEK_SET) == -1)
+ return -1;
return offset;
}
@@ -702,7 +703,8 @@ bool UDIFBlockChunkReadStream::Read(uint8_t* buffer,
off_t UDIFBlockChunkReadStream::Seek(off_t offset, int whence) {
DCHECK_EQ(SEEK_SET, whence);
- DCHECK_LT(static_cast<uint64_t>(offset), length_in_bytes_);
+ if (static_cast<uint64_t>(offset) >= length_in_bytes_)
+ return -1;
offset_ = offset;
return offset_;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698