vim-patch:8.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)

a216255a4f
This commit is contained in:
ckelsel
2017-09-28 11:47:26 +08:00
parent 65c97961ec
commit f97ca6b333
2 changed files with 7 additions and 4 deletions

View File

@@ -5845,9 +5845,12 @@ static void syntime_report(void)
} }
} }
/* sort on total time */ // Sort on total time. Skip if there are no items to avoid passing NULL
qsort(ga.ga_data, (size_t)ga.ga_len, sizeof(time_entry_T), // pointer to qsort().
syn_compare_syntime); if (ga.ga_len > 1) {
qsort(ga.ga_data, (size_t)ga.ga_len, sizeof(time_entry_T),
syn_compare_syntime);
}
MSG_PUTS_TITLE(_( MSG_PUTS_TITLE(_(
" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN")); " TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN"));

View File

@@ -948,7 +948,7 @@ static const int included_patches[] = {
158, 158,
// 157, // 157,
156, 156,
// 155, 155,
// 154, // 154,
// 153, // 153,
// 152 NA // 152 NA