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

Unified Diff: net/disk_cache/blockfile/file_posix.cc

Issue 2404823002: Fix error handling in POSIX version of the base::File::GetLength. (Closed)
Patch Set: Fix error handling in POSIX version of the base::File::GetLength. Created 4 years, 1 month 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
Index: net/disk_cache/blockfile/file_posix.cc
diff --git a/net/disk_cache/blockfile/file_posix.cc b/net/disk_cache/blockfile/file_posix.cc
index cdde5b0d45e73e4782ef493046dfb70a547cb1d3..828200588a9b66ac7a9d2ec14e304cca6a354c54 100644
--- a/net/disk_cache/blockfile/file_posix.cc
+++ b/net/disk_cache/blockfile/file_posix.cc
@@ -139,6 +139,8 @@ size_t File::GetLength() {
DCHECK(base_file_.IsValid());
int64_t len = base_file_.GetLength();
+ if (len < 0)
+ return 0;
if (len > static_cast<int64_t>(std::numeric_limits<uint32_t>::max()))
return std::numeric_limits<uint32_t>::max();

Powered by Google App Engine
This is Rietveld 408576698