From 70ae6cdd1fa03dbcaf8fe799f5ce6059b42ad22f Mon Sep 17 00:00:00 2001 From: "rlarocque@chromium.org" Date: Sat, 5 Oct 2013 05:31:17 +0000 Subject: [PATCH] Fix misuse of STL in InvalidatorRegistrar The invocation of std::set_intersection() in InvalidatorRegistrar was using the wrong kind of output iterator, which would lead to crashes under some conditions (eg. valgrind). It was technically invalid under any conditions; we were "lucky" that it didn't crash most of the time. BUG=304250 Review URL: https://codereview.chromium.org/25855007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227190 0039d316-1c4b-4281-b951-d872f2087c98 --- sync/notifier/invalidator_registrar.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sync/notifier/invalidator_registrar.cc b/sync/notifier/invalidator_registrar.cc index 43afa6e7650441..1c9c50cbbf2044 100644 --- a/sync/notifier/invalidator_registrar.cc +++ b/sync/notifier/invalidator_registrar.cc @@ -5,6 +5,7 @@ #include "sync/notifier/invalidator_registrar.h" #include +#include #include #include "base/logging.h" @@ -45,7 +46,8 @@ void InvalidatorRegistrar::UpdateRegisteredIds( std::set_intersection( it->second.begin(), it->second.end(), ids.begin(), ids.end(), - intersection.begin(), ObjectIdLessThan()); + std::inserter(intersection, intersection.end()), + ObjectIdLessThan()); CHECK(intersection.empty()) << "Duplicate registration: trying to register " << ObjectIdToString(*intersection.begin()) << " for "