From 0b9f61c9a60dc753c1ee26c387c367d667751d26 Mon Sep 17 00:00:00 2001 From: RaphaelHunter Date: Sat, 5 May 2018 16:46:51 +0800 Subject: [PATCH] add condition check in Imgae::create(...) (cherry picked from commit 63e258cc8fa653a66b6020d091abce3fad8e9db7) --- core/image.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/image.cpp b/core/image.cpp index 07e705265d6..0417075eec0 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -1166,6 +1166,9 @@ PoolVector Image::get_data() const { void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_format) { + ERR_FAIL_INDEX(p_width - 1, MAX_WIDTH); + ERR_FAIL_INDEX(p_height - 1, MAX_HEIGHT); + int mm = 0; int size = _get_dst_image_size(p_width, p_height, p_format, mm, p_use_mipmaps ? -1 : 0); data.resize(size);