From 384f78a13ceff1fb3577bfa916fcc9dd480fb23b Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 6 Apr 2022 00:16:07 +0200 Subject: [PATCH] psd: Don't assert on broken files oss-fuzz/46407 --- src/imageformats/psd.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/imageformats/psd.cpp b/src/imageformats/psd.cpp index 11a7341..2ff94fa 100644 --- a/src/imageformats/psd.cpp +++ b/src/imageformats/psd.cpp @@ -211,8 +211,11 @@ static PSDImageResourceSection readImageResourceSection(QDataStream &s, bool *ok } #ifdef QT_DEBUG - if (auto dev = s.device()) - Q_ASSERT((dev->pos()-pos) == sectioSize); + if (auto dev = s.device()) { + if ((dev->pos() - pos) != sectioSize) { + *ok = false; + } + } #endif return irs;