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

Unified Diff: extensions/common/manifest_handler_helpers.cc

Issue 1618073002: Extensions - Check for too big or too small product icons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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: extensions/common/manifest_handler_helpers.cc
diff --git a/extensions/common/manifest_handler_helpers.cc b/extensions/common/manifest_handler_helpers.cc
index bfc9e3378c4ca9f1f46eb83c30b734e0215dbf9e..9457864fcca4766722ef3d6a4a9308befee79a28 100644
--- a/extensions/common/manifest_handler_helpers.cc
+++ b/extensions/common/manifest_handler_helpers.cc
@@ -10,6 +10,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
+#include "extensions/common/constants.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_icon_set.h"
@@ -41,7 +42,8 @@ bool LoadIconsFromDictionary(const base::DictionaryValue* icons_value,
!iterator.IsAtEnd(); iterator.Advance()) {
int size = 0;
std::string icon_path;
- if (!base::StringToInt(iterator.key(), &size) ||
+ if (!base::StringToInt(iterator.key(), &size) || size <= 0 ||
+ size > extension_misc::EXTENSION_ICON_GIGANTOR * 4 ||
!iterator.value().GetAsString(&icon_path) ||
!NormalizeAndValidatePath(&icon_path)) {
*error = ErrorUtils::FormatErrorMessageUTF16(errors::kInvalidIconPath,
Devlin 2016/01/22 23:41:56 We should add a separate error for these (invalid
Evan Stade 2016/01/23 02:28:37 Done.

Powered by Google App Engine
This is Rietveld 408576698