diff options
Diffstat (limited to 'user/qt5-qtimageformats/kde-lts.patch')
-rw-r--r-- | user/qt5-qtimageformats/kde-lts.patch | 194 |
1 files changed, 130 insertions, 64 deletions
diff --git a/user/qt5-qtimageformats/kde-lts.patch b/user/qt5-qtimageformats/kde-lts.patch index ff05fd6bb..7eeb6737e 100644 --- a/user/qt5-qtimageformats/kde-lts.patch +++ b/user/qt5-qtimageformats/kde-lts.patch @@ -1,78 +1,144 @@ -From b43e31b9f31ec482ddea2066fda7ca9315512815 Mon Sep 17 00:00:00 2001 +From 978210714d48bcbda0fa2628f444a0a3a21a1b62 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland <eirik.aavitsland@qt.io> -Date: Fri, 13 May 2022 11:42:35 +0200 -Subject: [PATCH] Add some basic checking against corrupt input -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit +Date: Thu, 8 Sep 2022 14:52:19 +0200 +Subject: [PATCH 1/2] webp: support sequential input device if full file is + available -Fixes: QTBUG-103454 -Pick-to: 6.3 6.2 5.15 -Change-Id: I169b0de8465bc5d90aebfd8250db0361819065c5 -Reviewed-by: Robert Löhning <robert.loehning@qt.io> -(cherry picked from commit 34731687ee77c59607db9d88c6361111631e48c6) +Since we do no random access during decoding, just a readAll() of the +whole image file. So if it is all available already, we can handle a +sequential device. That is useful for Quick AnimationImage, which will +pass a finished QNetworkReply as the input device. + +This commit removes some seek() calls in the header checking, that +supposedly should reset the device position. These were in practice +either no-ops or bugs, since the device is only being peeked, so the +position never changes in the first place, and a QImageIOHandler is +supposed to read from the device at the position it is at when passed. + +Fixes: QTBUG-70245 +Change-Id: I5a4ff5fa4bbd19b0545ad41645969d714b4dc7d5 +Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> +Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> + + +(cherry picked from commit 369be99d82a7c1182e3693756ab545cea86bb90d) --- - src/plugins/imageformats/icns/qicnshandler.cpp | 16 +++++++++++----- - 1 file changed, 11 insertions(+), 5 deletions(-) + .../imageformats/webp/qwebphandler.cpp | 29 +++++++++---------- + 1 file changed, 14 insertions(+), 15 deletions(-) -diff --git a/src/plugins/imageformats/icns/qicnshandler.cpp b/src/plugins/imageformats/icns/qicnshandler.cpp -index dde783c..d6fc589 100644 ---- a/src/plugins/imageformats/icns/qicnshandler.cpp -+++ b/src/plugins/imageformats/icns/qicnshandler.cpp -@@ -515,6 +515,9 @@ static bool parseIconEntryInfo(ICNSEntry &icon) +diff --git a/src/plugins/imageformats/webp/qwebphandler.cpp b/src/plugins/imageformats/webp/qwebphandler.cpp +index 82d38cb..d02eb05 100644 +--- a/src/plugins/imageformats/webp/qwebphandler.cpp ++++ b/src/plugins/imageformats/webp/qwebphandler.cpp +@@ -45,6 +45,7 @@ + #include <qdebug.h> + #include <qpainter.h> + #include <qvariant.h> ++#include <QtEndian> + + static const int riffHeaderSize = 12; // RIFF_HEADER_SIZE from webp/format_constants.h + +@@ -102,21 +103,23 @@ bool QWebpHandler::ensureScanned() const + + m_scanState = ScanError; + +- if (device()->isSequential()) { +- qWarning() << "Sequential devices are not supported"; ++ QWebpHandler *that = const_cast<QWebpHandler *>(this); ++ const int headerBytesNeeded = sizeof(WebPBitstreamFeatures); ++ QByteArray header = device()->peek(headerBytesNeeded); ++ if (header.size() < headerBytesNeeded) + return false; +- } + +- qint64 oldPos = device()->pos(); +- device()->seek(0); +- +- QWebpHandler *that = const_cast<QWebpHandler *>(this); +- QByteArray header = device()->peek(sizeof(WebPBitstreamFeatures)); ++ // We do no random access during decoding, just a readAll() of the whole image file. So if ++ // if it is all available already, we can accept a sequential device. The riff header contains ++ // the file size minus 8 bytes header ++ qint64 byteSize = qFromLittleEndian<quint32>(header.constData() + 4); ++ if (device()->isSequential() && device()->bytesAvailable() < byteSize + 8) { ++ qWarning() << "QWebpHandler: Insufficient data available in sequential device"; ++ return false; ++ } + if (WebPGetFeatures((const uint8_t*)header.constData(), header.size(), &(that->m_features)) == VP8_STATUS_OK) { + if (m_features.has_animation) { + // For animation, we have to read and scan whole file to determine loop count and images count +- device()->seek(oldPos); +- + if (that->ensureDemuxer()) { + that->m_loop = WebPDemuxGetI(m_demuxer, WEBP_FF_LOOP_COUNT); + that->m_frameCount = WebPDemuxGetI(m_demuxer, WEBP_FF_FRAME_COUNT); +@@ -126,17 +129,13 @@ bool QWebpHandler::ensureScanned() const + if (that->m_features.has_alpha) + that->m_composited->fill(Qt::transparent); + +- // We do not reset device position since we have read in all data + m_scanState = ScanSuccess; +- return true; + } + } else { + m_scanState = ScanSuccess; } - icon.height = icon.width; } -+ // Sanity check -+ if (icon.width == 0 || icon.width > 4096 || icon.depth > 32) -+ return false; - return true; + +- device()->seek(oldPos); +- + return m_scanState == ScanSuccess; } -@@ -685,7 +688,7 @@ bool QICNSHandler::canRead() const - bool QICNSHandler::read(QImage *outImage) +@@ -159,7 +158,7 @@ bool QWebpHandler::ensureDemuxer() + + bool QWebpHandler::read(QImage *image) { - QImage img; -- if (!ensureScanned()) { -+ if (!ensureScanned() || m_currentIconIndex >= m_icons.size()) { - qWarning("QICNSHandler::read(): The device wasn't parsed properly!"); +- if (!ensureScanned() || device()->isSequential() || !ensureDemuxer()) ++ if (!ensureScanned() || !ensureDemuxer()) return false; - } -@@ -892,7 +895,7 @@ bool QICNSHandler::scanDevice() - return false; - const qint64 blockDataOffset = device()->pos(); -- if (!isBlockHeaderValid(blockHeader)) { -+ if (!isBlockHeaderValid(blockHeader, ICNSBlockHeaderSize + filelength - blockDataOffset)) { - qWarning("QICNSHandler::scanDevice(): Failed, bad header at pos %s. OSType \"%s\", length %u", - QByteArray::number(blockDataOffset).constData(), - nameFromOSType(blockHeader.ostype).constData(), blockHeader.length); -@@ -927,11 +930,14 @@ bool QICNSHandler::scanDevice() - case ICNSBlockHeader::TypeOdrp: - // Icns container seems to have an embedded icon variant container - // Let's start a scan for entries -- while (device()->pos() < nextBlockOffset) { -+ while (!stream.atEnd() && device()->pos() < nextBlockOffset) { - ICNSBlockHeader icon; - stream >> icon; -+ if (stream.status() != QDataStream::Ok) -+ return false; - // Check for incorrect variant entry header and stop scan -- if (!isBlockHeaderValid(icon, blockDataLength)) -+ quint64 remaining = blockDataLength - (device()->pos() - blockDataOffset); -+ if (!isBlockHeaderValid(icon, ICNSBlockHeaderSize + remaining)) - break; - if (!addEntry(icon, device()->pos(), blockHeader.ostype)) - return false; -@@ -1003,7 +1009,7 @@ bool QICNSHandler::scanDevice() - break; - } - } -- return true; -+ return (m_icons.size() > 0); - } + QRect prevFrameRect; +-- +2.49.0 + +From f86afca95741b9c06202fd13c2b8c01d922a0e24 Mon Sep 17 00:00:00 2001 +From: Volker Hilsheimer <volker.hilsheimer@qt.io> +Date: Fri, 18 Mar 2022 09:16:36 +0100 +Subject: [PATCH 2/2] Explicitly include QVarLengthArray header + +The template is instantiated, but only forward declared after recent +cleanup of transitive includes. + +Pick-to: 6.3 +Change-Id: Id43dfe4dc8aa20815ff6b5f64ab307a269ce6c67 +Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> +Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> +(cherry picked from commit 1224337fdf898e502d3b04f9eb3975947de06fe8) +--- + src/plugins/imageformats/tiff/qtiffhandler.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/plugins/imageformats/tiff/qtiffhandler.cpp b/src/plugins/imageformats/tiff/qtiffhandler.cpp +index f0dfe7f..5cb0522 100644 +--- a/src/plugins/imageformats/tiff/qtiffhandler.cpp ++++ b/src/plugins/imageformats/tiff/qtiffhandler.cpp +@@ -38,13 +38,14 @@ + ****************************************************************************/ + + #include "qtiffhandler_p.h" +-#include <qvariant.h> + #include <qcolorspace.h> + #include <qdebug.h> + #include <qimage.h> + #include <qglobal.h> + #include <qbuffer.h> + #include <qfiledevice.h> ++#include <qvariant.h> ++#include <qvarlengtharray.h> - const ICNSEntry &QICNSHandler::getIconMask(const ICNSEntry &icon) const + extern "C" { + #include "tiffio.h" -- -2.36.0 +2.49.0 |