0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.4255: theoretical computation overflow

Problem:    Theoretical computation overflow.
Solution:   Perform multiplication in a wider type. (closes #9657)
This commit is contained in:
=?UTF-8?q?Dundar=20G=C3=B6c?=
2022-01-29 15:19:23 +00:00
committed by Bram Moolenaar
parent f12b7815f6
commit d5cec1f1f0
11 changed files with 28 additions and 23 deletions

View File

@@ -4632,7 +4632,7 @@ garbage_collect(int testing)
// Don't make it bigger though.
if (exestack.ga_len + n < exestack.ga_maxlen)
{
new_len = exestack.ga_itemsize * (exestack.ga_len + n);
new_len = (size_t)exestack.ga_itemsize * (exestack.ga_len + n);
pp = vim_realloc(exestack.ga_data, new_len);
if (pp == NULL)
return FAIL;