You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Validates the p_format parameter in Image::create functions.
(cherry picked from commit 0b7ffd4f68)
This commit is contained in:
committed by
Rémi Verschelde
parent
6f58cfd077
commit
e0223edafc
@@ -1587,6 +1587,7 @@ void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_forma
|
|||||||
ERR_FAIL_COND_MSG(p_width > MAX_WIDTH, "Image width cannot be greater than " + itos(MAX_WIDTH) + ".");
|
ERR_FAIL_COND_MSG(p_width > MAX_WIDTH, "Image width cannot be greater than " + itos(MAX_WIDTH) + ".");
|
||||||
ERR_FAIL_COND_MSG(p_height > MAX_HEIGHT, "Image height cannot be greater than " + itos(MAX_HEIGHT) + ".");
|
ERR_FAIL_COND_MSG(p_height > MAX_HEIGHT, "Image height cannot be greater than " + itos(MAX_HEIGHT) + ".");
|
||||||
ERR_FAIL_COND_MSG(write_lock.ptr(), "Cannot create image when it is locked.");
|
ERR_FAIL_COND_MSG(write_lock.ptr(), "Cannot create image when it is locked.");
|
||||||
|
ERR_FAIL_INDEX_MSG(p_format, FORMAT_MAX, "Image format out of range, please see Image's Format enum.");
|
||||||
|
|
||||||
int mm = 0;
|
int mm = 0;
|
||||||
int size = _get_dst_image_size(p_width, p_height, p_format, mm, p_use_mipmaps ? -1 : 0);
|
int size = _get_dst_image_size(p_width, p_height, p_format, mm, p_use_mipmaps ? -1 : 0);
|
||||||
@@ -1607,6 +1608,7 @@ void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_forma
|
|||||||
ERR_FAIL_COND_MSG(p_height <= 0, "Image height must be greater than 0.");
|
ERR_FAIL_COND_MSG(p_height <= 0, "Image height must be greater than 0.");
|
||||||
ERR_FAIL_COND_MSG(p_width > MAX_WIDTH, "Image width cannot be greater than " + itos(MAX_WIDTH) + ".");
|
ERR_FAIL_COND_MSG(p_width > MAX_WIDTH, "Image width cannot be greater than " + itos(MAX_WIDTH) + ".");
|
||||||
ERR_FAIL_COND_MSG(p_height > MAX_HEIGHT, "Image height cannot be greater than " + itos(MAX_HEIGHT) + ".");
|
ERR_FAIL_COND_MSG(p_height > MAX_HEIGHT, "Image height cannot be greater than " + itos(MAX_HEIGHT) + ".");
|
||||||
|
ERR_FAIL_INDEX_MSG(p_format, FORMAT_MAX, "Image format out of range, please see Image's Format enum.");
|
||||||
|
|
||||||
int mm;
|
int mm;
|
||||||
int size = _get_dst_image_size(p_width, p_height, p_format, mm, p_use_mipmaps ? -1 : 0);
|
int size = _get_dst_image_size(p_width, p_height, p_format, mm, p_use_mipmaps ? -1 : 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user