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

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

Issue 2225123002: [Mac] Convert a DCHECK to a condition in safe_browsing::dmg::UDIFBlockChunkReadStream::Seek. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
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 90fde88ca673dce9d79304dfbc5becff37326b70..92bd1ac4f7a1b8532b6216cd6f7209e6bb398e1e 100644
--- a/chrome/utility/safe_browsing/mac/udif.cc
+++ b/chrome/utility/safe_browsing/mac/udif.cc
@@ -609,7 +609,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;
}
@@ -657,7 +658,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