summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcdn@chromium.org <cdn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-05 20:37:32 +0000
committercdn@chromium.org <cdn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-05 20:37:32 +0000
commit678a7d737ffd81978c981d692972695e4ad7f394 (patch)
tree40707f7085b8cdc0e7f47099c2c8098564b8c6a3
parentd6cbd42672ac02cd96ee7724e721803f3e2bd5cc (diff)
downloadchromium_src-678a7d737ffd81978c981d692972695e4ad7f394.zip
chromium_src-678a7d737ffd81978c981d692972695e4ad7f394.tar.gz
chromium_src-678a7d737ffd81978c981d692972695e4ad7f394.tar.bz2
Fixed check for max icon size before sending InstallApplication msg to browser.
BUG=68646 TEST=None Review URL: http://codereview.chromium.org/6009011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70538 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/renderer/render_view.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index b972506..6f97958 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -820,16 +820,16 @@ void RenderView::DidDownloadApplicationIcon(ImageResourceFetcher* fetcher,
// some alternative way to transmit the icon data to the browser process.
//
// See also: bug 63729.
- const int kMaxIconSize = 1024 * 128;
- int actual_icon_size = 0;
+ const size_t kMaxIconSize = 1024 * 128;
+ size_t actual_icon_size = 0;
for (size_t i = 0; i < pending_app_info_->icons.size(); ++i) {
- actual_icon_size += pending_app_info_->icons[i].data.getSize();
- }
-
- if (actual_icon_size > kMaxIconSize) {
- AddErrorToRootConsole(ASCIIToUTF16(
+ size_t current_size = pending_app_info_->icons[i].data.getSize();
+ if (current_size > kMaxIconSize - actual_icon_size) {
+ AddErrorToRootConsole(ASCIIToUTF16(
"Icons are too large. Maximum total size for app icons is 128 KB."));
- return;
+ return;
+ }
+ actual_icon_size += current_size;
}
Send(new ViewHostMsg_InstallApplication(routing_id_, *pending_app_info_));