mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 03:18:37 +08:00
Fix bits_per_pixel validation in BMP and TGA loader modules.
This commit is contained in:
parent
ecee0c92ff
commit
115f6d14a0
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user