diff --git a/libheif/plugins/decoder_dav1d.cc b/libheif/plugins/decoder_dav1d.cc index ce5ea98a06..f8e3ed53a4 100644 --- a/libheif/plugins/decoder_dav1d.cc +++ b/libheif/plugins/decoder_dav1d.cc @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include @@ -90,7 +92,13 @@ struct heif_error dav1d_new_decoder(void** dec) dav1d_default_settings(&decoder->settings); - decoder->settings.frame_size_limit = heif_get_global_security_limits()->max_image_size_pixels; + if (std::cmp_greater(heif_get_global_security_limits()->max_image_size_pixels, std::numeric_limits::max())) { + decoder->settings.frame_size_limit = 0; + } + else { + decoder->settings.frame_size_limit = static_cast(heif_get_global_security_limits()->max_image_size_pixels); + } + decoder->settings.all_layers = 0; if (dav1d_open(&decoder->context, &decoder->settings) != 0) {