summaryrefslogtreecommitdiffstats
path: root/src/network/access/qdecompresshelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/access/qdecompresshelper.cpp')
-rw-r--r--src/network/access/qdecompresshelper.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/network/access/qdecompresshelper.cpp b/src/network/access/qdecompresshelper.cpp
index 2e44a58cf4..d0e75ef0dc 100644
--- a/src/network/access/qdecompresshelper.cpp
+++ b/src/network/access/qdecompresshelper.cpp
@@ -405,6 +405,11 @@ void QDecompressHelper::setArchiveBombDetectionEnabled(bool enable)
countHelper->setArchiveBombDetectionEnabled(enable);
}
+void QDecompressHelper::setMinimumArchiveBombSize(qint64 threshold)
+{
+ minimumArchiveBombSize = threshold;
+}
+
bool QDecompressHelper::isPotentialArchiveBomb() const
{
if (!archiveBombDetectionEnabled)
@@ -413,6 +418,9 @@ bool QDecompressHelper::isPotentialArchiveBomb() const
if (totalCompressedBytes == 0)
return false;
+ if (totalUncompressedBytes <= minimumArchiveBombSize)
+ return false;
+
// Some protection against malicious or corrupted compressed files that expand far more than
// is reasonable.
double ratio = double(totalUncompressedBytes) / double(totalCompressedBytes);