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

Unified Diff: util/file/string_file_writer.cc

Issue 434103003: Fix StringFileWriter::Seek() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years, 5 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: util/file/string_file_writer.cc
diff --git a/util/file/string_file_writer.cc b/util/file/string_file_writer.cc
index 2c2f1f5236be84d7aa373801707dee2b93885b63..5875a327eb0937d4a5d91ed3d2ff398c453b5a74 100644
--- a/util/file/string_file_writer.cc
+++ b/util/file/string_file_writer.cc
@@ -110,26 +110,26 @@ off_t StringFileWriter::Seek(off_t offset, int whence) {
return -1;
}
- off_t offset_offt;
- if (!AssignIfInRange(&offset_offt, base_offset)) {
+ off_t base_offset_offt;
+ if (!AssignIfInRange(&base_offset_offt, base_offset)) {
LOG(ERROR) << "Seek(): base_offset " << base_offset << " invalid for off_t";
return -1;
}
-
- base::CheckedNumeric<off_t> new_offset(offset_offt);
+ base::CheckedNumeric<off_t> new_offset(base_offset_offt);
new_offset += offset;
if (!new_offset.IsValid()) {
LOG(ERROR) << "Seek(): new_offset invalid";
return -1;
}
-
- if (!AssignIfInRange(&offset_offt, new_offset.ValueOrDie())) {
- LOG(ERROR) << "Seek(): new_offset " << new_offset.ValueOrDie()
+ off_t new_offset_offt = new_offset.ValueOrDie();
+ size_t new_offset_sizet;
+ if (!AssignIfInRange(&new_offset_sizet, new_offset_offt)) {
+ LOG(ERROR) << "Seek(): new_offset " << new_offset_offt
<< " invalid for size_t";
return -1;
}
- offset_ = offset_offt;
+ offset_ = new_offset_sizet;
return offset_.ValueOrDie();
}
« 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