Skip to content

Commit 5e9aaed

Browse files
yegappanchrisbra
authored andcommitted
patch 9.1.1031: Coverity complains about insecure data handling
Problem: Coverity complains about insecure data handling (v9.1.1024) Solution: use int consistently to access the blob index (Yegappan Lakshmanan) related: #16468 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 54cb514 commit 5e9aaed

4 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/fileio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4308,7 +4308,7 @@ buf_check_timestamp(
43084308
*/
43094309
busy = TRUE;
43104310
#ifdef FEAT_EVAL
4311-
set_vim_var_string(VV_FCS_REASON, (char_u *)reason, reasonlen);
4311+
set_vim_var_string(VV_FCS_REASON, (char_u *)reason, (int)reasonlen);
43124312
set_vim_var_string(VV_FCS_CHOICE, (char_u *)"", 0);
43134313
#endif
43144314
++allbuf_lock;

src/strings.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ string_from_blob(blob_T *blob, long *start_idx)
12651265
{
12661266
garray_T str_ga;
12671267
long blen;
1268-
long idx;
1268+
int idx;
12691269

12701270
ga_init2(&str_ga, sizeof(char), 80);
12711271

src/testdir/test_functions.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4282,6 +4282,9 @@ func Test_str2blob()
42824282
call assert_equal(0zABBB0AABBB, str2blob(['«»', '«»'], {'encoding': 'latin1'}))
42834283
call assert_equal(0zC2ABC2BB, str2blob(['«»'], {'encoding': 'utf8'}))
42844284

4285+
call assert_equal(0z62, str2blob(["b"], test_null_dict()))
4286+
call assert_equal(0z63, str2blob(["c"], {'encoding': test_null_string()}))
4287+
42854288
call assert_fails("call str2blob(['abc'], [])", 'E1206: Dictionary required for argument 2')
42864289
call assert_fails("call str2blob(['abc'], {'encoding': []})", 'E730: Using a List as a String')
42874290
call assert_fails("call str2blob(['abc'], {'encoding': 'ab12xy'})", 'E1515: Unable to convert to ''ab12xy'' encoding')

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
1031,
707709
/**/
708710
1030,
709711
/**/

0 commit comments

Comments
 (0)