To: vim_dev@googlegroups.com Subject: Patch 8.1.1653 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1653 Problem: Ubsan warns for possibly passing NULL pointer. Solution: Skip code when length is zero. (Dominique Pelle, closes #4631) Files: src/channel.c *** ../vim-8.1.1652/src/channel.c 2019-06-28 22:06:41.110072146 +0200 --- src/channel.c 2019-07-08 22:01:10.759502396 +0200 *************** *** 3990,3996 **** writeq_T *last = wq->wq_prev; /* append to the last entry */ ! if (ga_grow(&last->wq_ga, len) == OK) { mch_memmove((char *)last->wq_ga.ga_data + last->wq_ga.ga_len, --- 3990,3996 ---- writeq_T *last = wq->wq_prev; /* append to the last entry */ ! if (len > 0 && ga_grow(&last->wq_ga, len) == OK) { mch_memmove((char *)last->wq_ga.ga_data + last->wq_ga.ga_len, *************** *** 4012,4018 **** wq->wq_prev->wq_next = last; wq->wq_prev = last; ga_init2(&last->wq_ga, 1, 1000); ! if (ga_grow(&last->wq_ga, len) == OK) { mch_memmove(last->wq_ga.ga_data, buf, len); last->wq_ga.ga_len = len; --- 4012,4018 ---- wq->wq_prev->wq_next = last; wq->wq_prev = last; ga_init2(&last->wq_ga, 1, 1000); ! if (len > 0 && ga_grow(&last->wq_ga, len) == OK) { mch_memmove(last->wq_ga.ga_data, buf, len); last->wq_ga.ga_len = len; *** ../vim-8.1.1652/src/version.c 2019-07-08 21:57:26.291708275 +0200 --- src/version.c 2019-07-08 22:03:52.403195879 +0200 *************** *** 779,780 **** --- 779,782 ---- { /* Add new patch number below this line */ + /**/ + 1653, /**/ -- DENNIS: Listen -- strange women lying in ponds distributing swords is no basis for a system of government. Supreme executive power derives from a mandate from the masses, not from some farcical aquatic ceremony. The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///