diff --git a/src/imageformats/heif.cpp b/src/imageformats/heif.cpp index d399273..68470a7 100644 --- a/src/imageformats/heif.cpp +++ b/src/imageformats/heif.cpp @@ -261,6 +261,11 @@ bool HEIFHandler::canRead(QIODevice *device) } const QByteArray header = device->peek(28); + return HEIFHandler::isSupportedBMFFType(header); +} + +bool HEIFHandler::isSupportedBMFFType(const QByteArray &header) +{ if (header.size() < 28) { return false; } @@ -364,7 +369,7 @@ bool HEIFHandler::ensureDecoder() } const QByteArray buffer = device()->readAll(); - if (buffer.isEmpty()) { + if (!HEIFHandler::isSupportedBMFFType(buffer)) { m_parseState = ParseHeicError; return false; } diff --git a/src/imageformats/heif_p.h b/src/imageformats/heif_p.h index dd3e342..c9fcb05 100644 --- a/src/imageformats/heif_p.h +++ b/src/imageformats/heif_p.h @@ -10,6 +10,7 @@ #ifndef KIMG_HEIF_P_H #define KIMG_HEIF_P_H +#include #include #include @@ -28,6 +29,7 @@ public: void setOption(ImageOption option, const QVariant &value) override; bool supportsOption(ImageOption option) const override; private: + static bool isSupportedBMFFType(const QByteArray &header); bool ensureParsed() const; bool ensureDecoder();