patch 9.1.1818: possible crash when calculating topline in diff.c
Problem: possible crash when calculating topline in diff.c
(youngmith)
Solution: Check for pointer being Null before accessing it
fixes: #18437
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@ -2226,6 +2226,7 @@ calculate_topfill_and_topline(
|
||||
diff_T *thistopdiff = NULL;
|
||||
diff_T *next_adjacent_blocks = NULL;
|
||||
int virtual_lines_passed = 0;
|
||||
int curlinenum_to = 1;
|
||||
|
||||
find_top_diff_block(&thistopdiff, &next_adjacent_blocks, fromidx, from_topline);
|
||||
|
||||
@ -2253,7 +2254,8 @@ calculate_topfill_and_topline(
|
||||
|
||||
// move the same amount of virtual lines in the target buffer to find the
|
||||
// cursor's line number
|
||||
int curlinenum_to = thistopdiff->df_lnum[toidx];
|
||||
if (thistopdiff != NULL)
|
||||
curlinenum_to = thistopdiff->df_lnum[toidx];
|
||||
|
||||
int virt_lines_left = virtual_lines_passed;
|
||||
curdif = thistopdiff;
|
||||
|
||||
Reference in New Issue
Block a user