# HG changeset patch # User Christian Brabandt # Date 1483894804 -3600 # Node ID ea5adbeccfc144f5d66beeecb5a593e2286b0038 # Parent 9a58ba5999968f74b958b9cfe608883b9e610868 commit https://github.com/vim/vim/commit/a216255a4faa91a15e7005ac319f2f62294f3f9e Author: Bram Moolenaar Date: Sun Jan 8 17:46:20 2017 +0100 patch 8.0.0155: ubsan complains about NULL pointer Problem: When sorting zero elements a NULL pointer is passed to qsort(), which ubsan warns for. Solution: Don't call qsort() if there are no elements. (Dominique Pelle) diff --git a/src/syntax.c b/src/syntax.c --- a/src/syntax.c +++ b/src/syntax.c @@ -6704,8 +6704,10 @@ syntime_report(void) } } - /* sort on total time */ - qsort(ga.ga_data, (size_t)ga.ga_len, sizeof(time_entry_T), + /* Sort on total time. Skip if there are no items to avoid passing NULL + * pointer to qsort(). */ + if (ga.ga_len > 1) + qsort(ga.ga_data, (size_t)ga.ga_len, sizeof(time_entry_T), syn_compare_syntime); MSG_PUTS_TITLE(_(" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN")); diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 155, +/**/ 154, /**/ 153,