From f8dce7ade942bbd7f4e024d80e2f93579ad16708 Mon Sep 17 00:00:00 2001 From: "Andrii Doroshenko (Xrayez)" Date: Wed, 17 Jul 2019 01:43:33 +0300 Subject: [PATCH] Fix BMP loader incorrectly interpreting color table size Color table should exist for images with bit count <= 8. Importing 16-bit BMP images could also likely have a color table but they're not currently supported in Godot. (cherry picked from commit d5c5aabbf28bdae7e7b5e2be0b66f640a0cd62cf) --- modules/bmp/image_loader_bmp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/bmp/image_loader_bmp.cpp b/modules/bmp/image_loader_bmp.cpp index bcc992db241..904dd1b7d9d 100644 --- a/modules/bmp/image_loader_bmp.cpp +++ b/modules/bmp/image_loader_bmp.cpp @@ -257,8 +257,8 @@ Error ImageLoaderBMP::load_image(Ref p_image, FileAccess *f, if (bmp_header.bmp_info_header.bmp_bit_count <= 8) { // Support 256 colors max color_table_size = 1 << bmp_header.bmp_info_header.bmp_bit_count; + ERR_FAIL_COND_V(color_table_size == 0, ERR_BUG); } - ERR_FAIL_COND_V(color_table_size == 0, ERR_BUG); PoolVector bmp_color_table; if (color_table_size > 0) {