| 1 |
Descriptionscip-debian debian qtimageformats-opensource-src 5.15.19-2 qtimageformats-opensource-src/patches/`CVE-2025-5683.patch`#Description.: fix validation issue for ICNS image |
| 2 |
The header validation logic could trigger an assert when an invalid ICNS |
| 3 |
image was loaded. This patch fixes the validation logic. |
| 4 |
Originscip-debian debian qtimageformats-opensource-src 5.15.19-2 qtimageformats-opensource-src/patches/`CVE-2025-5683.patch`#Origin.: upstream, https://code.qt.io/cgit/qt/qtimageformats.git/commit/?id=efd332516f510144 |
| 5 |
Last-Updatescip-debian debian qtimageformats-opensource-src 5.15.19-2 qtimageformats-opensource-src/patches/`CVE-2025-5683.patch`#Last-Update.: 2025-06-06 |
| 6 |
|
| 7 |
--- a/src/plugins/imageformats/icns/qicnshandler.cppscip-debian debian qtimageformats-opensource-src 5.15.19-2 qtimageformats-opensource-src/upstream/`src/plugins/imageformats/icns/qicnshandler.cpp`: |
| 8 |
+++ b/src/plugins/imageformats/icns/qicnshandler.cppscip-debian debian qtimageformats-opensource-src 5.15.19-2 qtimageformats-opensource-src/upstream/`src/plugins/imageformats/icns/qicnshandler.cpp`: |
| 9 |
@@ -359,8 +359,11 @@ static inline bool isPowOf2OrDividesBy16 |
| 10 |
|
| 11 |
static inline bool isBlockHeaderValid(const ICNSBlockHeader &header, quint64 bound = 0) |
| 12 |
{ |
| 13 |
|
| 14 |
|
| 15 |
+ return header.ostype != 0 && |
| 16 |
+ (bound == 0 || |
| 17 |
+ // qBound can be used but requires checking the limits first |
| 18 |
+ // this requires less operations |
| 19 |
+ (ICNSBlockHeaderSize <= header.length && header.length <= bound)); |
| 20 |
} |
| 21 |
|
| 22 |
static inline bool isIconCompressed(const ICNSEntry &icon) |
| 23 |
@@ -899,7 +902,7 @@ bool QICNSHandler::scanDevice() |
| 24 |
return false; |
| 25 |
|
| 26 |
const qint64 blockDataOffset = device()->pos(); |
| 27 |
|
| 28 |
+ if (!isBlockHeaderValid(blockHeader, ICNSBlockHeaderSize - blockDataOffset + filelength)) { |
| 29 |
qWarning("QICNSHandler::scanDevice(): Failed, bad header at pos %s. OSType \"%s\", length %u", |
| 30 |
QByteArray::number(blockDataOffset).constData(), |
| 31 |
nameFromOSType(blockHeader.ostype).constData(), blockHeader.length); |