heif: reject invalid files with zero size

This commit is contained in:
Daniel Novomeský 2023-01-29 16:21:01 +01:00
parent 4c6d2b92b6
commit c1c57d9a11

View File

@ -449,6 +449,14 @@ bool HEIFHandler::ensureDecoder()
return false;
}
if ((heif_image_handle_get_width(handle) == 0) || (heif_image_handle_get_height(handle) == 0)) {
m_parseState = ParseHeicError;
heif_image_handle_release(handle);
heif_context_free(ctx);
qWarning() << "HEIC image has zero dimension";
return false;
}
const bool hasAlphaChannel = heif_image_handle_has_alpha_channel(handle);
const int bit_depth = heif_image_handle_get_luma_bits_per_pixel(handle);
heif_chroma chroma;