From 62e477a6f25d7cf792d4326da6e93f6bf8bb4e0e Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 3 Aug 2022 19:23:19 +0200 Subject: [PATCH] Protect against too big resize for a QByteArray oss-fuzz/48480 --- src/imageformats/psd.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/imageformats/psd.cpp b/src/imageformats/psd.cpp index a8c206d..7c4c669 100644 --- a/src/imageformats/psd.cpp +++ b/src/imageformats/psd.cpp @@ -938,6 +938,9 @@ inline void labToRgb(uchar *target, qint32 targetChannels, const char *source, q bool readChannel(QByteArray& target, QDataStream &stream, quint32 compressedSize, quint16 compression) { if (compression) { + if (compressedSize > kMaxQVectorSize) { + return false; + } QByteArray tmp; tmp.resize(compressedSize); if (stream.readRawData(tmp.data(), tmp.size()) != tmp.size()) {