diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-11-01 22:12:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-01 22:12:47 +0100 |
commit | af4fd9de9c02052f3dc7330cd7cb6aa3f2107191 (patch) | |
tree | eeac97cd39ee467902921a75fbdf3e5238716f4a /core | |
parent | 86fdb51e04a10362b502df95dd52286701aec521 (diff) | |
parent | 9ddb3265e1a6d2f9937ff6a27d04302d76c10431 (diff) |
Merge pull request #33238 from qarmin/other_fixes
Fix some crashes, overflows and using variables without values
Diffstat (limited to 'core')
-rw-r--r-- | core/image.cpp | 5 | ||||
-rw-r--r-- | core/ustring.cpp | 5 | ||||
-rw-r--r-- | core/ustring.h | 1 |
3 files changed, 9 insertions, 2 deletions
diff --git a/core/image.cpp b/core/image.cpp index 89d23b8dbd..74706535b3 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -1284,8 +1284,8 @@ static void _generate_po2_mipmap(const Component *p_src, Component *p_dst, uint3 Component *dst_ptr = &p_dst[i * dst_w * CC]; uint32_t count = dst_w; - while (count--) { - + while (count) { + count--; for (int j = 0; j < CC; j++) { average_func(dst_ptr[j], rup_ptr[j], rup_ptr[j + right_step], rdown_ptr[j], rdown_ptr[j + right_step]); } @@ -1375,6 +1375,7 @@ void Image::shrink_x2() { int ps = get_format_pixel_size(format); new_img.resize((width / 2) * (height / 2) * ps); ERR_FAIL_COND(new_img.size() == 0); + ERR_FAIL_COND(data.size() == 0); { PoolVector<uint8_t>::Write w = new_img.write(); diff --git a/core/ustring.cpp b/core/ustring.cpp index f029ae4200..7ee2fee312 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -4058,6 +4058,11 @@ String itos(int64_t p_val) { return String::num_int64(p_val); } +String uitos(uint64_t p_val) { + + return String::num_uint64(p_val); +} + String rtos(double p_val) { return String::num(p_val); diff --git a/core/ustring.h b/core/ustring.h index 15e2c07d9f..dfc5044942 100644 --- a/core/ustring.h +++ b/core/ustring.h @@ -369,6 +369,7 @@ String operator+(const char *p_chr, const String &p_str); String operator+(CharType p_chr, const String &p_str); String itos(int64_t p_val); +String uitos(uint64_t p_val); String rtos(double p_val); String rtoss(double p_val); //scientific version |