]> git.ipfire.org Git - thirdparty/vim.git/commit
patch 9.1.0608: Coverity warns about a few potential issues v9.1.0608
authorChristian Brabandt <cb@256bit.org>
Sat, 20 Jul 2024 11:26:44 +0000 (13:26 +0200)
committerChristian Brabandt <cb@256bit.org>
Sat, 20 Jul 2024 11:26:44 +0000 (13:26 +0200)
commit220474d239bfca0b36f7ca9cc9fdb9dab5dd384e
treee24475ed0c2ba2524ba7ad4bb2c5bde660818eb3
parent4aa6b52e82871fe3a607756de609b9c14feb4e04
patch 9.1.0608: Coverity warns about a few potential issues

Problem:  Coverity warns about a few potential issues
Solution: Fix those issues (see details below)

1) Fix overflow warning in highlight.c
   This happens because we are comparing int with long
   and assign a potential long value to an int, which
   could cause an overflow. So add some casts to ensure
   the value fits into an int.

2) Fix Overflow warning in shift_line().
   This happens because we are performing a division/modulo
   operation of a long type by an int type and assign the result
   to an int, which could then overflow. So before performing
   the operation, trim the long to value to at most max int value,
   so that it can't overflow.

3) Fix overflow warning in syn_list_cluster in syntax.c
   This is essential the same issue as 1)

4) not checking the return value of vim_mkdir() in spellfile.c
   Creating the spell directory could fail. Handle this case
   and return early in this case.

5) qsort() may deref a NULL pointer when fuzzy match does not
   return a result. Fix this by checking that the accessed growarray
   fuzzy_indices actually contains  data. If not we can silently skip
   the qsort() and related logic.

closes: #15284

Signed-off-by: Christian Brabandt <cb@256bit.org>
src/highlight.c
src/insexpand.c
src/ops.c
src/spellfile.c
src/syntax.c
src/version.c