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

Unified Diff: content/browser/renderer_host/pepper/pepper_file_system_browser_host.cc

Issue 54233002: Make net::DataURL's MIME string check stricter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Split web_url_loader_impl change Created 6 years, 7 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
« no previous file with comments | « no previous file | net/base/data_url.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/pepper/pepper_file_system_browser_host.cc
diff --git a/content/browser/renderer_host/pepper/pepper_file_system_browser_host.cc b/content/browser/renderer_host/pepper/pepper_file_system_browser_host.cc
index 20ffdc74a9f725f9708b7b0cb5e643b977934811..5eec410500202c6400e5bdb0504fb1cf53b64527 100644
--- a/content/browser/renderer_host/pepper/pepper_file_system_browser_host.cc
+++ b/content/browser/renderer_host/pepper/pepper_file_system_browser_host.cc
@@ -484,13 +484,15 @@ std::string PepperFileSystemBrowserHost::GeneratePluginId(
// types). If we bring this API to stable, we might have to make it more
// general.
- if (!net::IsMimeType(mime_type))
+ std::string top_level_type;
+ std::string subtype;
+ if (!net::ParseMimeTypeWithoutParameter(
+ mime_type, &top_level_type, &subtype) ||
+ !net::IsValidTopLevelMimeType(top_level_type))
return std::string();
- std::string output = mime_type;
// Replace a slash used for type/subtype separator with an underscore.
- // NOTE: This assumes there is only one slash in the MIME type.
- ReplaceFirstSubstringAfterOffset(&output, 0, "/", "_");
+ std::string output = top_level_type + "_" + subtype;
// Verify |output| contains only alphabets, digits, or "._-".
for (std::string::const_iterator it = output.begin(); it != output.end();
« no previous file with comments | « no previous file | net/base/data_url.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698