Fix bits_per_pixel validation in BMP and TGA loader modules.

(cherry picked from commit 115f6d14a0)
This commit is contained in:
Saracen 2018-07-08 18:51:20 +01:00 committed by Rémi Verschelde
parent 16e6d6fede
commit 493e220ab9
1 changed files with 2 additions and 1 deletions

View File

@ -250,8 +250,9 @@ Error ImageLoaderTGA::load_image(Ref<Image> p_image, FileAccess *f, bool p_force
if (tga_header.image_width <= 0 || tga_header.image_height <= 0) if (tga_header.image_width <= 0 || tga_header.image_height <= 0)
err = FAILED; err = FAILED;
if (tga_header.pixel_depth != 8 && tga_header.pixel_depth != 24 && tga_header.pixel_depth != 32) if (!(tga_header.pixel_depth == 8 || tga_header.pixel_depth == 24 || tga_header.pixel_depth == 32)) {
err = FAILED; err = FAILED;
}
if (err == OK) { if (err == OK) {
f->seek(f->get_position() + tga_header.id_length); f->seek(f->get_position() + tga_header.id_length);