mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-07-18 03:54:18 -04:00
Check the input buffer before passing it to libheif
This commit is contained in:
committed by
Daniel Novomeský
parent
c532227d43
commit
511a22f0b4
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user