summaryrefslogtreecommitdiffstats
path: root/src/network/access
diff options
context:
space:
mode:
authorMÃ¥rten Nordheim <marten.nordheim@qt.io>2021-06-24 14:16:58 +0200
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2021-07-02 13:05:32 +0000
commitd33040548ff727a040ea66174cbd838e883fed56 (patch)
tree4fec418e852df0bb2381a74925f59bdb57ccd502 /src/network/access
parentf95d03b3721369e3bd9e60c50f90405a617849cd (diff)
QNetworkRequest: Rename (set)minimumArchiveBombSize
To (set)decompressedSafetyCheckThreshold, as suggested on the API review. Task-number: QTBUG-94407 Change-Id: Iffc52691022939ae46703de8a0416355487b716f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/network/access')
-rw-r--r--src/network/access/qdecompresshelper.cpp10
-rw-r--r--src/network/access/qdecompresshelper_p.h4
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp3
-rw-r--r--src/network/access/qnetworkrequest.cpp14
-rw-r--r--src/network/access/qnetworkrequest.h4
5 files changed, 18 insertions, 17 deletions
diff --git a/src/network/access/qdecompresshelper.cpp b/src/network/access/qdecompresshelper.cpp
index d51f9a290e..451684bf1b 100644
--- a/src/network/access/qdecompresshelper.cpp
+++ b/src/network/access/qdecompresshelper.cpp
@@ -329,7 +329,7 @@ bool QDecompressHelper::countInternal(const QByteArray &data)
if (countDecompressed) {
if (!countHelper) {
countHelper = std::make_unique<QDecompressHelper>();
- countHelper->setMinimumArchiveBombSize(minimumArchiveBombSize);
+ countHelper->setDecompressedSafetyCheckThreshold(archiveBombCheckThreshold);
countHelper->setEncoding(contentEncoding);
}
countHelper->feed(data);
@@ -347,7 +347,7 @@ bool QDecompressHelper::countInternal(const QByteDataBuffer &buffer)
if (countDecompressed) {
if (!countHelper) {
countHelper = std::make_unique<QDecompressHelper>();
- countHelper->setMinimumArchiveBombSize(minimumArchiveBombSize);
+ countHelper->setDecompressedSafetyCheckThreshold(archiveBombCheckThreshold);
countHelper->setEncoding(contentEncoding);
}
countHelper->feed(buffer);
@@ -398,11 +398,11 @@ qsizetype QDecompressHelper::read(char *data, qsizetype maxSize)
By default this is 10MB. Setting it to -1 is treated as disabling the
feature.
*/
-void QDecompressHelper::setMinimumArchiveBombSize(qint64 threshold)
+void QDecompressHelper::setDecompressedSafetyCheckThreshold(qint64 threshold)
{
if (threshold == -1)
threshold = std::numeric_limits<qint64>::max();
- minimumArchiveBombSize = threshold;
+ archiveBombCheckThreshold = threshold;
}
bool QDecompressHelper::isPotentialArchiveBomb() const
@@ -410,7 +410,7 @@ bool QDecompressHelper::isPotentialArchiveBomb() const
if (totalCompressedBytes == 0)
return false;
- if (totalUncompressedBytes <= minimumArchiveBombSize)
+ if (totalUncompressedBytes <= archiveBombCheckThreshold)
return false;
// Some protection against malicious or corrupted compressed files that expand far more than
diff --git a/src/network/access/qdecompresshelper_p.h b/src/network/access/qdecompresshelper_p.h
index 96199a91f8..33241e14f1 100644
--- a/src/network/access/qdecompresshelper_p.h
+++ b/src/network/access/qdecompresshelper_p.h
@@ -91,7 +91,7 @@ public:
void clear();
- void setMinimumArchiveBombSize(qint64 threshold);
+ void setDecompressedSafetyCheckThreshold(qint64 threshold);
static bool isSupportedEncoding(const QByteArray &encoding);
static QByteArrayList acceptedEncoding();
@@ -118,7 +118,7 @@ private:
qint64 uncompressedBytes = 0;
// Used for calculating the ratio
- qint64 minimumArchiveBombSize = 10 * 1024 * 1024;
+ qint64 archiveBombCheckThreshold = 10 * 1024 * 1024;
qint64 totalUncompressedBytes = 0;
qint64 totalCompressedBytes = 0;
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
index cc6590f713..b68e82a5e1 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -1366,7 +1366,8 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData(const QList<QPair<QByte
error(QNetworkReplyImpl::NetworkError::ProtocolFailure,
QCoreApplication::translate("QHttp", "Data corrupted"));
}
- decompressHelper.setMinimumArchiveBombSize(request.minimumArchiveBombSize());
+ decompressHelper.setDecompressedSafetyCheckThreshold(
+ request.decompressedSafetyCheckThreshold());
}
if (!value.isEmpty()) {
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index 29eefb4a70..b15a0189f4 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -441,7 +441,7 @@ public:
peerVerifyName = other.peerVerifyName;
#if QT_CONFIG(http)
h2Configuration = other.h2Configuration;
- minimumArchiveBombSize = other.minimumArchiveBombSize;
+ decompressedSafetyCheckThreshold = other.decompressedSafetyCheckThreshold;
#endif
transferTimeout = other.transferTimeout;
}
@@ -456,7 +456,7 @@ public:
peerVerifyName == other.peerVerifyName
#if QT_CONFIG(http)
&& h2Configuration == other.h2Configuration
- && minimumArchiveBombSize == other.minimumArchiveBombSize
+ && decompressedSafetyCheckThreshold == other.decompressedSafetyCheckThreshold
#endif
&& transferTimeout == other.transferTimeout
;
@@ -472,7 +472,7 @@ public:
QString peerVerifyName;
#if QT_CONFIG(http)
QHttp2Configuration h2Configuration;
- qint64 minimumArchiveBombSize = 10ll * 1024ll * 1024ll;
+ qint64 decompressedSafetyCheckThreshold = 10ll * 1024ll * 1024ll;
#endif
int transferTimeout;
};
@@ -910,9 +910,9 @@ void QNetworkRequest::setHttp2Configuration(const QHttp2Configuration &configura
\sa setMinimumArchiveBombSize()
*/
-qint64 QNetworkRequest::minimumArchiveBombSize() const
+qint64 QNetworkRequest::decompressedSafetyCheckThreshold() const
{
- return d->minimumArchiveBombSize;
+ return d->decompressedSafetyCheckThreshold;
}
/*!
@@ -937,9 +937,9 @@ qint64 QNetworkRequest::minimumArchiveBombSize() const
\sa minimumArchiveBombSize()
*/
-void QNetworkRequest::setMinimumArchiveBombSize(qint64 threshold)
+void QNetworkRequest::setDecompressedSafetyCheckThreshold(qint64 threshold)
{
- d->minimumArchiveBombSize = threshold;
+ d->decompressedSafetyCheckThreshold = threshold;
}
#endif // QT_CONFIG(http) || defined(Q_CLANG_QDOC)
diff --git a/src/network/access/qnetworkrequest.h b/src/network/access/qnetworkrequest.h
index fe18115f75..72848ff490 100644
--- a/src/network/access/qnetworkrequest.h
+++ b/src/network/access/qnetworkrequest.h
@@ -180,8 +180,8 @@ public:
QHttp2Configuration http2Configuration() const;
void setHttp2Configuration(const QHttp2Configuration &configuration);
- qint64 minimumArchiveBombSize() const;
- void setMinimumArchiveBombSize(qint64 threshold);
+ qint64 decompressedSafetyCheckThreshold() const;
+ void setDecompressedSafetyCheckThreshold(qint64 threshold);
#endif // QT_CONFIG(http) || defined(Q_CLANG_QDOC)
#if QT_CONFIG(http) || defined(Q_CLANG_QDOC) || defined (Q_OS_WASM)