summaryrefslogtreecommitdiff
path: root/modules/pvr/image_compress_pvrtc.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-06-29 12:44:20 +0200
committerGitHub <noreply@github.com>2021-06-29 12:44:20 +0200
commit05336adb86574608b5ab922d20a06428331287cc (patch)
treed2b951c7c1ac7cfc7216910ea3157c7e76382dbe /modules/pvr/image_compress_pvrtc.cpp
parent9c6d7f840f6f226e5d422fc7697cb75ead6c401b (diff)
parent3dae9993acf489aa46ccb7a3420a2e67ee59362f (diff)
Merge pull request #49905 from pfertyk/issue-46480-image-compress-crashes-godot
Validate image formats, check if resize_to_po2 failed
Diffstat (limited to 'modules/pvr/image_compress_pvrtc.cpp')
-rw-r--r--modules/pvr/image_compress_pvrtc.cpp4
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) {