summaryrefslogtreecommitdiff
path: root/modules/tga
diff options
context:
space:
mode:
authorSaracen <SaracenOne@gmail.com>2018-07-08 18:51:20 +0100
committerSaracen <SaracenOne@gmail.com>2018-07-08 18:51:20 +0100
commit115f6d14a0c1e6e108ea4b91179357eedea32173 (patch)
treec25c26f77e74560fcad83f6f744403b754dd838a /modules/tga
parentecee0c92ff86911fa50e745b4ab98196e0d2afe4 (diff)
Fix bits_per_pixel validation in BMP and TGA loader modules.
Diffstat (limited to 'modules/tga')
-rw-r--r--modules/tga/image_loader_tga.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/tga/image_loader_tga.cpp b/modules/tga/image_loader_tga.cpp
index 7391bed699..d4fa88afa7 100644
--- a/modules/tga/image_loader_tga.cpp
+++ b/modules/tga/image_loader_tga.cpp
@@ -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)
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);