diff options
author | Paweł Fertyk <pfertyk@pfertyk.me> | 2021-06-25 13:50:22 +0200 |
---|---|---|
committer | Paweł Fertyk <pfertyk@pfertyk.me> | 2021-06-28 21:17:06 +0200 |
commit | 3dae9993acf489aa46ccb7a3420a2e67ee59362f (patch) | |
tree | 5d585d1777d4eb83de0c0bef4dc03e4482ea95b7 /modules | |
parent | 89f270f4c5b1edf655966d11bc7b1ea14ad39a13 (diff) |
Validate image formats, check if resize_to_po2 failed
Diffstat (limited to 'modules')
-rw-r--r-- | modules/pvr/image_compress_pvrtc.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
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) { |