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

Unified Diff: chrome/browser/extensions/extension_action.cc

Issue 1647903003: Fix the dynamic browser action setIcon path to work with any size icon. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2623
Patch Set: Created 4 years, 11 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/extensions/extension_action.cc
diff --git a/chrome/browser/extensions/extension_action.cc b/chrome/browser/extensions/extension_action.cc
index 5476478e1e5bfffb95c7230445cea92a436f2ae9..4742e75b488fa5d261e3cf7e4cf48a88bff2776c 100644
--- a/chrome/browser/extensions/extension_action.cc
+++ b/chrome/browser/extensions/extension_action.cc
@@ -130,8 +130,12 @@ bool ExtensionAction::ParseIconFromCanvasDictionary(
for (base::DictionaryValue::Iterator iter(dict); !iter.IsAtEnd();
iter.Advance()) {
int icon_size = 0;
- if (!base::StringToInt(iter.key(), &icon_size))
+ // Chrome helpfully scales the provided icon(s), but let's not go overboard.
+ const int kActionIconMaxSize = 10 * extension_misc::EXTENSION_ICON_ACTION;
+ if (!base::StringToInt(iter.key(), &icon_size) || icon_size <= 0 ||
+ icon_size > kActionIconMaxSize) {
continue;
+ }
const base::BinaryValue* image_data;
std::string binary_string64;

Powered by Google App Engine
This is Rietveld 408576698