From 0d579dd580e7ef2c2416594fabced8f95612b000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=BCri=20Valdmann?= <juri.valdmann@qt.io>
Date: Tue, 18 Sep 2018 13:04:17 +0200
Subject: [PATCH] Set a maximum size on favicons

Favicons are downloaded by the render process and sent back via mojo message.
However, mojo messages have a maximum size; if the favicon doesn't fit, the
render process is killed. Impose a maximum size to ensure that favicons can fit
in mojo messages.

Task-number: QTBUG-69123
Change-Id: I6027bc310dcc77ec530145e4f125efa36106464f
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
---
 src/core/favicon_manager.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/core/favicon_manager.cpp b/src/core/favicon_manager.cpp
index 2a7d78320..de6a0f183 100644
--- a/src/core/favicon_manager.cpp
+++ b/src/core/favicon_manager.cpp
@@ -84,6 +84,7 @@ FaviconManager::~FaviconManager()
 
 int FaviconManager::downloadIcon(const QUrl &url)
 {
+    static const uint32_t maxSize = 256;
     static int fakeId = 0;
     int id;
 
@@ -95,7 +96,7 @@ int FaviconManager::downloadIcon(const QUrl &url)
         id = m_webContents->DownloadImage(
              toGurl(url),
              true, // is_favicon
-             0,    // no max size
+             maxSize,
              false, // normal cache policy
              base::Bind(&FaviconManager::iconDownloadFinished, m_weakFactory->GetWeakPtr()));
     }
-- 
GitLab