summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-01-08 17:46:20 +0100
committerBram Moolenaar <Bram@vim.org>2017-01-08 17:46:20 +0100
commita216255a4faa91a15e7005ac319f2f62294f3f9e (patch)
treeb26ce4a074f220711b9da9d573cc37e3d60db6ef
parent31f19ce0a052f7c76d44a9a190e468c79cf5d56d (diff)
downloadvim-git-a216255a4faa91a15e7005ac319f2f62294f3f9e.tar.gz
patch 8.0.0155: ubsan complains about NULL pointerv8.0.0155
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)
-rw-r--r--src/syntax.c6
-rw-r--r--src/version.c2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/syntax.c b/src/syntax.c
index b2108e4d9..80546bb02 100644
--- 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
index 368e6bea3..d88c03be7 100644
--- 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,