From 3dae9993acf489aa46ccb7a3420a2e67ee59362f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Fertyk?= Date: Fri, 25 Jun 2021 13:50:22 +0200 Subject: Validate image formats, check if resize_to_po2 failed --- modules/pvr/image_compress_pvrtc.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'modules/pvr/image_compress_pvrtc.cpp') diff --git a/modules/pvr/image_compress_pvrtc.cpp b/modules/pvr/image_compress_pvrtc.cpp index f33912cec0..980cac17d3 100644 --- a/modules/pvr/image_compress_pvrtc.cpp +++ b/modules/pvr/image_compress_pvrtc.cpp @@ -43,6 +43,10 @@ static void _compress_pvrtc1_4bpp(Image *p_img) { if (!img->is_size_po2() || img->get_width() != img->get_height()) { make_mipmaps = img->has_mipmaps(); img->resize_to_po2(true); + // Resizing can fail for some formats + if (!img->is_size_po2() || img->get_width() != img->get_height()) { + ERR_FAIL_MSG("Failed to resize the image for compression."); + } } img->convert(Image::FORMAT_RGBA8); if (!img->has_mipmaps() && make_mipmaps) { -- cgit v1.2.3