diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-12-10 13:52:40 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-12-10 14:29:24 +0800 |
commit | 7a7ed0c8ac2d66d695da5bd3f90536e8c5c11ccc (patch) | |
tree | f19dcf946b2166a42c780c704986221e0ae91681 /scripts/cdoc_parser.lua | |
parent | ac230370f3de2925b3ca9443e8d52d7fc4311aba (diff) | |
download | rneovim-7a7ed0c8ac2d66d695da5bd3f90536e8c5c11ccc.tar.gz rneovim-7a7ed0c8ac2d66d695da5bd3f90536e8c5c11ccc.tar.bz2 rneovim-7a7ed0c8ac2d66d695da5bd3f90536e8c5c11ccc.zip |
vim-patch:9.0.2122: [security]: prevent overflow in indenting
Problem: [security]: prevent overflow in indenting
Solution: use long long and remove cast to (int)
The shiftwidth option values are defined as being long. However, when
calculating the actual amount of indent, we cast down to (int), which
may cause the shiftwidth value to become negative and later it may even
cause Vim to try to allocate a huge amount of memory.
We already use long and long long variable types to calculate the indent
(and detect possible overflows), so the cast to (int) seems superfluous
and can be safely removed. So let's just remove the (int) cast and
calculate the indent using longs.
Additionally, the 'shiftwidth' option value is also used when determining
the actual 'cino' options. There it can again cause another overflow, so
make sure it is safe in parse_cino() as well.
fixes: vim/vim#13554
closes: vim/vim#13555
https://github.com/vim/vim/commit/3770574e4a70e810add9929973c51f9070c8c851
Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'scripts/cdoc_parser.lua')
0 files changed, 0 insertions, 0 deletions