Merge pull request #26077 from vrabaud:avif_check

Disable strict mode when reading avif files
This commit is contained in:
Alexander Smorkalov 2024-08-28 16:15:01 +03:00 committed by GitHub
commit bacefd3b8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -143,6 +143,7 @@ AvifDecoder::AvifDecoder() {
m_buf_supported = true;
channels_ = 0;
decoder_ = avifDecoderCreate();
decoder_->strictFlags = AVIF_STRICT_DISABLED;
}
AvifDecoder::~AvifDecoder() {
@ -166,6 +167,7 @@ bool AvifDecoder::checkSignature(const String &signature) const {
std::unique_ptr<avifDecoder, decltype(&avifDecoderDestroy)> decoder(
avifDecoderCreate(), avifDecoderDestroy);
if (!decoder) return false;
decoder->strictFlags = AVIF_STRICT_DISABLED;
OPENCV_AVIF_CHECK_STATUS(
avifDecoderSetIOMemory(
decoder.get(), reinterpret_cast<const uint8_t *>(signature.c_str()),