From 493e220ab95fbc444efc4c64898cb8507cf4b830 Mon Sep 17 00:00:00 2001 From: Saracen Date: Sun, 8 Jul 2018 18:51:20 +0100 Subject: [PATCH] Fix bits_per_pixel validation in BMP and TGA loader modules. (cherry picked from commit 115f6d14a0c1e6e108ea4b91179357eedea32173) --- modules/tga/image_loader_tga.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/tga/image_loader_tga.cpp b/modules/tga/image_loader_tga.cpp index 094af13c946..d5006de1b6e 100644 --- a/modules/tga/image_loader_tga.cpp +++ b/modules/tga/image_loader_tga.cpp @@ -250,8 +250,9 @@ Error ImageLoaderTGA::load_image(Ref p_image, FileAccess *f, bool p_force if (tga_header.image_width <= 0 || tga_header.image_height <= 0) 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; + } if (err == OK) { f->seek(f->get_position() + tga_header.id_length);