avif: return false in canRead() when imageIndex >= imageCount

Otherwise when `cache: false` is set in AnimatedImage, QMovie will try
to read the image forever.

BUG: 460085
FIXED-IN: 5.100
This commit is contained in:
Fushan Wen 2022-10-15 11:40:41 +08:00
parent bcbf45e23a
commit 350ce1b990
No known key found for this signature in database
GPG Key ID: 2E48D1487C91DCAA

View File

@ -42,6 +42,11 @@ bool QAVIFHandler::canRead() const
if (m_parseState != ParseAvifError) {
setFormat("avif");
if (m_parseState == ParseAvifSuccess && m_decoder->imageIndex >= m_decoder->imageCount - 1) {
return false;
}
return true;
}
return false;