diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2020-08-19 12:47:47 +0200 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2020-09-22 19:08:53 +0200 |
commit | a07f35409bc1e129b027fc7ccb312949a454f66e (patch) | |
tree | 84cde42e8d76a0eb0abbaddf474975eb8393a57f /src/network/access/qnetworkreplyhttpimpl.cpp | |
parent | 16a1ddd73337c2622499c77b12de9395d43aba87 (diff) |
QDecompressHelper: limit decompression ratio
To avoid potential decompression bombs. This is implemented with just
a simple check that the ratio doesn't pass some hardcoded preset.
Change-Id: I17246f0f43e73280cdb35a8f03d65885f5678ad6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/network/access/qnetworkreplyhttpimpl.cpp')
-rw-r--r-- | src/network/access/qnetworkreplyhttpimpl.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 5ba11333bf..921b482d10 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -774,6 +774,14 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq if (request.attribute(QNetworkRequest::EmitAllUploadProgressSignalsAttribute).toBool()) emitAllUploadProgressSignals = true; + // For internal use/testing + auto ignoreDownloadRatio = + request.attribute(QNetworkRequest::Attribute(QNetworkRequest::User - 1)); + if (!ignoreDownloadRatio.isNull() && ignoreDownloadRatio.canConvert<QByteArray>() + && ignoreDownloadRatio.toByteArray() == "__qdecompresshelper_ignore_download_ratio") { + httpRequest.setIgnoreDecompressionRatio(true); + } + httpRequest.setPeerVerifyName(newHttpRequest.peerVerifyName()); // Create the HTTP thread delegate |