summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/renderer_host/web_channel_ipc_transport_host.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/renderer_host/web_channel_ipc_transport_host.cpp b/src/core/renderer_host/web_channel_ipc_transport_host.cpp
index b1aab00a1..9758f73bf 100644
--- a/src/core/renderer_host/web_channel_ipc_transport_host.cpp
+++ b/src/core/renderer_host/web_channel_ipc_transport_host.cpp
@@ -52,10 +52,13 @@
#include <QJsonObject>
#include <QLoggingCategory>
-#include <QtCore/private/qjson_p.h>
-
namespace QtWebEngineCore {
+enum {
+ // sizeof(QJsonPrivate::Header) + sizeof(QJsonPrivate::Base)
+ MinimumBinaryJsonSize = 8 + 12
+};
+
Q_LOGGING_CATEGORY(log, "qt.webengine.webchanneltransport")
inline QDebug operator<<(QDebug stream, content::RenderFrameHost *frame)
@@ -145,7 +148,7 @@ void WebChannelIPCTransportHost::DispatchWebChannelMessage(const std::vector<uin
QJsonDocument doc;
// QJsonDocument::fromRawData does not check the length before it starts
// parsing the QJsonPrivate::Header and QJsonPrivate::Base structures.
- if (binaryJson.size() >= sizeof(QJsonPrivate::Header) + sizeof(QJsonPrivate::Base))
+ if (binaryJson.size() >= MinimumBinaryJsonSize)
doc = QJsonDocument::fromRawData(reinterpret_cast<const char *>(binaryJson.data()),
binaryJson.size());