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

Unified Diff: components/subresource_filter/core/browser/ruleset_service.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: components/subresource_filter/core/browser/ruleset_service.cc
diff --git a/components/subresource_filter/core/browser/ruleset_service.cc b/components/subresource_filter/core/browser/ruleset_service.cc
index 3a0c5fcb3a4b2992e3bf3e8efc2b06a4231e9f00..6c80bb00e6b429e5cf1ed56112748e087793d2c8 100644
--- a/components/subresource_filter/core/browser/ruleset_service.cc
+++ b/components/subresource_filter/core/browser/ruleset_service.cc
@@ -346,6 +346,8 @@ bool RulesetService::IndexRuleset(base::File unindexed_ruleset_file,
SCOPED_UMA_HISTOGRAM_TIMER("SubresourceFilter.IndexRuleset.WallDuration");
int64_t unindexed_ruleset_size = unindexed_ruleset_file.GetLength();
+ if (unindexed_ruleset_size < 0)
+ return false;
CopyingFileInputStream copying_stream(std::move(unindexed_ruleset_file));
google::protobuf::io::CopyingInputStreamAdaptor zero_copy_stream_adaptor(
&copying_stream, 4096 /* buffer_size */);

Powered by Google App Engine
This is Rietveld 408576698