From 5e57b850b6664d5c0c7bf057bb8013e23830ae5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Fertyk?= Date: Mon, 10 Jan 2022 23:49:51 +0100 Subject: [PATCH] Issue 56488 fail when image and texture size are different --- scene/resources/texture.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index e8718894ec0..61ef9a91fbe 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -2625,6 +2625,9 @@ void TextureLayered::create(uint32_t p_width, uint32_t p_height, uint32_t p_dept void TextureLayered::set_layer_data(const Ref &p_image, int p_layer) { ERR_FAIL_COND(!texture.is_valid()); ERR_FAIL_COND(!p_image.is_valid()); + ERR_FAIL_COND_MSG( + p_image->get_width() > width || p_image->get_height() > height, + vformat("Image size(%dx%d) is bigger than texture size (%dx%d).", p_image->get_width(), p_image->get_height(), width, height)); VS::get_singleton()->texture_set_data(texture, p_image, p_layer); }