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

Unified Diff: chrome/browser/search_engines/template_url_service.h

Issue 23536053: Fix read-after-free when loading two search engines with the same keyword. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 3 months 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: chrome/browser/search_engines/template_url_service.h
===================================================================
--- chrome/browser/search_engines/template_url_service.h (revision 222964)
+++ chrome/browser/search_engines/template_url_service.h (working copy)
@@ -425,7 +425,11 @@
// Sets the keywords. This is used once the keywords have been loaded.
// This does NOT notify the delegate or the database.
- void SetTemplateURLs(const TemplateURLVector& urls);
+ //
+ // This transfers ownership of the elements in |urls| to |this|, and may
+ // delete some elements, so it's not safe for callers to access any elements
+ // after calling; to reinforce this, this function clears |urls| on exit.
+ void SetTemplateURLs(TemplateURLVector* urls);
// Transitions to the loaded state.
void ChangeToLoadedState();
@@ -615,6 +619,10 @@
// Adds |template_urls| to |template_urls_| and sets up the default search
// provider. If |default_search_provider| is non-NULL, it must refer to one
// of the |template_urls|, and will be used as the new default.
+ //
+ // This transfers ownership of the elements in |urls| to |this|, and may
+ // delete some elements, so it's not safe for callers to access any elements
+ // after calling; to reinforce this, this function clears |urls| on exit.
beaudoin 2013/09/14 03:24:03 Nit: |urls| --> |template_urls|
Peter Kasting 2013/09/16 21:10:12 Done.
void AddTemplateURLsAndSetupDefaultEngine(
TemplateURLVector* template_urls,
TemplateURL* default_search_provider);

Powered by Google App Engine
This is Rietveld 408576698