]> git.ipfire.org Git - thirdparty/vim.git/commit
patch 9.1.0399: block_editing errors out when using del v9.1.0399
authorChristian Brabandt <cb@256bit.org>
Wed, 8 May 2024 20:17:19 +0000 (22:17 +0200)
committerChristian Brabandt <cb@256bit.org>
Wed, 8 May 2024 20:17:19 +0000 (22:17 +0200)
commitd5c8c0920e1eee9ff7a9fa5168d8e85c01670630
treeaf52487bbf563bb1fcdfec770e07ff3dea60fce6
parentcb3691811be93b2c49179649c684d6ce2141a46f
patch 9.1.0399: block_editing errors out when using del

Problem:  block_editing errors out when using del
          (@Jamarley)
Solution: Change ins_len from size_t to int and
          properly check that it doesn't become negative

There is a check in os.c that verifies that `ins_len` does not become
negative:
```
if (pre_textlen >= 0 && (ins_len = len - pre_textlen - offset) > 0)
```
However this only works, if ins_len can actually become negative and
unfortunately, ins_len has been declared as `size_t` so instead of
becoming negative it will wrap around and be very large.

So let's define it as integer, after which the condition above
properly catches this condition.

fixes: #14734
closes: #14735

Signed-off-by: Christian Brabandt <cb@256bit.org>
src/ops.c
src/testdir/test_visual.vim
src/version.c