diff options
author | Max Hilbrunner <mhilbrunner@users.noreply.github.com> | 2018-07-10 13:35:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-10 13:35:14 +0200 |
commit | 04d9f8dbd6b1ec517c2d66db19efa93517933232 (patch) | |
tree | 21e3c19a97eb6a69a38055e213e6ebea8a9912b1 | |
parent | 41ff975b8cce9d9dedaf6eabd47051b18bd72f8e (diff) | |
parent | 115f6d14a0c1e6e108ea4b91179357eedea32173 (diff) |
Merge pull request #20046 from SaracenOne/bmp_fix
Fix bits_per_pixel validation in BMP and TGA loader modules.
-rw-r--r-- | modules/bmp/image_loader_bmp.cpp | 2 | ||||
-rw-r--r-- | modules/tga/image_loader_tga.cpp | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/modules/bmp/image_loader_bmp.cpp b/modules/bmp/image_loader_bmp.cpp index 769119a0dc..919731b52b 100644 --- a/modules/bmp/image_loader_bmp.cpp +++ b/modules/bmp/image_loader_bmp.cpp @@ -53,7 +53,7 @@ Error ImageLoaderBMP::convert_to_image(Ref<Image> p_image, err = FAILED; } - if (bits_per_pixel != 24 || bits_per_pixel != 32) { + if (!(bits_per_pixel == 24 || bits_per_pixel == 32)) { err = FAILED; } 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); |