diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-10-30 10:54:13 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-10-30 11:01:52 +0100 |
commit | 6c736295cf1ead52f7f4ca99138d678573dab03c (patch) | |
tree | e0485c16742e9952bbf4668000bedf4ab88217e6 /src | |
parent | 5907f31e472b04553eb44cbec54c98bd06c3fee9 (diff) |
Remove superfluous length check before parsing binary JSON
The check has been added to QJsonDocument in 5.11. Also, the binary JSON
types have been moved around, so this check won't work anymore.
Change-Id: I70436cf039cba0810cfccc2041fce655ceb9b6df
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/renderer_host/web_channel_ipc_transport_host.cpp | 10 |
1 files changed, 2 insertions, 8 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 e1929e4cd..f04ef4b46 100644 --- a/src/core/renderer_host/web_channel_ipc_transport_host.cpp +++ b/src/core/renderer_host/web_channel_ipc_transport_host.cpp @@ -52,8 +52,6 @@ #include <QJsonObject> #include <QLoggingCategory> -#include <QtCore/private/qjson_p.h> - namespace QtWebEngineCore { Q_LOGGING_CATEGORY(log, "qt.webengine.webchanneltransport"); @@ -142,12 +140,8 @@ void WebChannelIPCTransportHost::DispatchWebChannelMessage(const std::vector<uin return; } - 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)) - doc = QJsonDocument::fromRawData(reinterpret_cast<const char *>(binaryJson.data()), - binaryJson.size()); + QJsonDocument doc = QJsonDocument::fromRawData( + reinterpret_cast<const char *>(binaryJson.data()), binaryJson.size()); if (!doc.isObject()) { qCCritical(log).nospace() << "received invalid webchannel message from " << frame; |