patch 9.1.0722: crash with large id in text_prop interface

Problem:  crash with large id in text_prop interface
          prop_add()/prop_add_list() (cposture)
Solution: Error out if the id is > INT_MAX or <= INT_MIN

fixes: #15637
closes: #15638

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2024-09-08 20:05:23 +02:00
parent 5b9237c2e7
commit 701c863e68
4 changed files with 32 additions and 8 deletions

View File

@ -1,4 +1,4 @@
*textprop.txt* For Vim version 9.1. Last change: 2024 Jun 08
*textprop.txt* For Vim version 9.1. Last change: 2024 Sep 08
VIM REFERENCE MANUAL by Bram Moolenaar
@ -140,10 +140,10 @@ prop_add({lnum}, {col}, {props})
bufnr buffer to add the property to; when omitted
the current buffer is used
id user defined ID for the property; must be a
number, should be positive; when using "text"
then "id" must not be present and will be set
automatically to a negative number; otherwise
zero is used
number, should be positive |E1510|;
when using "text" then "id" must not be
present and will be set automatically to a
negative number; otherwise zero is used
*E1305*
text text to be displayed before {col}, or
above/below the line if {col} is zero; prepend
@ -271,7 +271,7 @@ prop_add_list({props}, [{item}, ...]) *prop_add_list()*
call prop_add_list(#{type: 'MyProp', id: 2},
\ [[1, 4, 1, 7],
\ [1, 15, 1, 20],
\ [2, 30, 3, 30]]
\ [2, 30, 3, 30]])
<
Can also be used as a |method|: >
GetProp()->prop_add_list([[1, 1, 1, 2], [1, 4, 1, 8]])