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

Unified Diff: components/safe_browsing_db/v4_get_hash_protocol_manager.cc

Issue 2490753002: Ignore ThreatMatch responses for lists that we don't care about. (Closed)
Patch Set: 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/safe_browsing_db/v4_get_hash_protocol_manager.cc
diff --git a/components/safe_browsing_db/v4_get_hash_protocol_manager.cc b/components/safe_browsing_db/v4_get_hash_protocol_manager.cc
index fff3ac7acf0400e4432205cae1e7fd65d72e2ac8..c561e0709ebb09a96ba5eb0adaca422e42ebae93 100644
--- a/components/safe_browsing_db/v4_get_hash_protocol_manager.cc
+++ b/components/safe_browsing_db/v4_get_hash_protocol_manager.cc
@@ -527,8 +527,19 @@ bool V4GetHashProtocolManager::ParseHashResponse(
return false;
}
- ListIdentifier list_id(match.platform_type(), match.threat_entry_type(),
- match.threat_type());
+ const PlatformType& platform_type = match.platform_type();
Nathan Parker 2016/11/08 23:50:11 Nit: these temporaries add a lot more chars then t
vakh (use Gerrit instead) 2016/11/10 01:05:55 Done.
+ const ThreatEntryType& threat_entry_type = match.threat_entry_type();
+ const ThreatType& threat_type = match.threat_type();
+ if (platform_types_.find(platform_type) == platform_types_.end() ||
+ threat_entry_types_.find(threat_entry_type) ==
+ threat_entry_types_.end() ||
+ threat_types_.find(threat_type) == threat_types_.end()) {
+ // The server may send a ThreatMatch response for lists that we didn't ask
+ // for so ignore those ThreatMatch responses.
+ continue;
+ }
+
+ ListIdentifier list_id(platform_type, threat_entry_type, threat_type);
base::Time positive_expiry;
if (match.has_cache_duration()) {
// Seconds resolution is good enough so we ignore the nanos field.

Powered by Google App Engine
This is Rietveld 408576698