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>
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index 57277f7..bbb911f 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -393,6 +393,8 @@
call assert_fails('call prop_add_list(test_null_dict(), [[2, 2, 2]])', 'E965:')
call assert_fails('call prop_add_list(#{type: "one"}, test_null_list())', 'E1298:')
call assert_fails('call prop_add_list(#{type: "one"}, [test_null_list()])', 'E714:')
+ call assert_fails('call prop_add_list(#{type: "one", id: 2147483648}, [[2, 2, 2, 2], [3, 20, 3, 22]])', 'E1510:')
+ call assert_fails('call prop_add_list(#{type: "one", id: -2147483648}, [[2, 2, 2, 2], [3, 20, 3, 22]])', 'E1510:')
" only one error for multiple wrong values
call assert_fails('call prop_add_list(#{type: "one"}, [[{}, [], 0z00, 0.3]])', ['E728:', 'E728:'])
@@ -1780,6 +1782,8 @@
call assert_fails("call prop_add(2, 3, {'type': 'xxx', 'length':-1})", 'E475:')
call assert_fails("call prop_add(2, 3, {'type': 'xxx', 'end_col':0})", 'E475:')
call assert_fails("call prop_add(2, 3, {'length':1})", 'E965:')
+ call assert_fails("call prop_add(2, 3, {'type': 'xxx', 'id': 2147483648})", 'E1510:')
+ call assert_fails("call prop_add(2, 3, {'type': 'xxx', 'id': -2147483648})", 'E1510:')
call prop_type_delete('xxx')
bwipe!