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

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 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 d772734d7c69f39e793ecf1c34132dc993cd7c36..179375b5069e865b9ebedfea38b460fa03733f46 100644
--- a/components/subresource_filter/core/browser/ruleset_service.cc
+++ b/components/subresource_filter/core/browser/ruleset_service.cc
@@ -349,6 +349,8 @@ bool RulesetService::IndexRuleset(base::File unindexed_ruleset_file,
"SubresourceFilter.IndexRuleset.CPUDuration");
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