Skip to content

Commit 0d07155

Browse files
committed
patch 8.1.1653: ubsan warns for possibly passing NULL pointer
Problem: Ubsan warns for possibly passing NULL pointer. Solution: Skip code when length is zero. (Dominique Pelle, closes #4631)
1 parent 49fe95f commit 0d07155

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/channel.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3990,7 +3990,7 @@ channel_send(
39903990
writeq_T *last = wq->wq_prev;
39913991

39923992
/* append to the last entry */
3993-
if (ga_grow(&last->wq_ga, len) == OK)
3993+
if (len > 0 && ga_grow(&last->wq_ga, len) == OK)
39943994
{
39953995
mch_memmove((char *)last->wq_ga.ga_data
39963996
+ last->wq_ga.ga_len,
@@ -4012,7 +4012,7 @@ channel_send(
40124012
wq->wq_prev->wq_next = last;
40134013
wq->wq_prev = last;
40144014
ga_init2(&last->wq_ga, 1, 1000);
4015-
if (ga_grow(&last->wq_ga, len) == OK)
4015+
if (len > 0 && ga_grow(&last->wq_ga, len) == OK)
40164016
{
40174017
mch_memmove(last->wq_ga.ga_data, buf, len);
40184018
last->wq_ga.ga_len = len;

src/version.c

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

778778
static int included_patches[] =
779779
{ /* Add new patch number below this line */
780+
/**/
781+
1653,
780782
/**/
781783
1652,
782784
/**/

0 commit comments

Comments
 (0)