Commit: patch 9.1.1023: Coverity complains about dereferencing NULL pointer

6 views
Skip to first unread message

Christian Brabandt

unread,
Jan 16, 2025, 1:15:14 PM1/16/25
to vim...@googlegroups.com
patch 9.1.1023: Coverity complains about dereferencing NULL pointer

Commit: https://github.com/vim/vim/commit/a9f77be9223f8b886d89f7fac778d363586beb85
Author: Christian Brabandt <c...@256bit.org>
Date: Thu Jan 16 19:06:57 2025 +0100

patch 9.1.1023: Coverity complains about dereferencing NULL pointer

Problem: Coverity complains about dereferencing NULL pointer
Solution: Verify curdiff is not null before dereferencing it

closes: #16437

Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/diff.c b/src/diff.c
index 7e5664172..c348894ec 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -2062,8 +2062,11 @@ count_filler_lines_and_topline(
else
{
(*linesfiller) = 0;
- ch_virtual_lines = get_max_diff_length(curdif);
- isfiller = (curdif->df_count[toidx] ? FALSE : TRUE);
+ if (curdif)
+ {
+ ch_virtual_lines = get_max_diff_length(curdif);
+ isfiller = (curdif->df_count[toidx] ? FALSE : TRUE);
+ }
if (isfiller)
{
while (curdif && curdif->df_next &&
diff --git a/src/version.c b/src/version.c
index f2d77568f..92bba8500 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1023,
/**/
1022,
/**/
Reply all
Reply to author
Forward
0 new messages