diff options
author | ckelsel <ckelsel@hotmail.com> | 2017-09-28 11:47:26 +0800 |
---|---|---|
committer | ckelsel <ckelsel@hotmail.com> | 2017-09-28 12:28:25 +0800 |
commit | f97ca6b3339ca04477296c834a159d40d2201ccd (patch) | |
tree | 42ad6ff7fa8de87472b1923b083d7fc39ed39da2 /src | |
parent | 65c97961ecdcfa89bb0ce9ff88f1e84e4d926f21 (diff) | |
download | rneovim-f97ca6b3339ca04477296c834a159d40d2201ccd.tar.gz rneovim-f97ca6b3339ca04477296c834a159d40d2201ccd.tar.bz2 rneovim-f97ca6b3339ca04477296c834a159d40d2201ccd.zip |
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)
https://github.com/vim/vim/commit/a216255a4faa91a15e7005ac319f2f62294f3f9e
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/syntax.c | 9 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 65c0e2464a..5781424d2b 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -5845,9 +5845,12 @@ static void syntime_report(void) } } - /* sort on total time */ - qsort(ga.ga_data, (size_t)ga.ga_len, sizeof(time_entry_T), - syn_compare_syntime); + // 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/nvim/version.c b/src/nvim/version.c index 6b57185b50..1432a92998 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -948,7 +948,7 @@ static const int included_patches[] = { 158, // 157, 156, - // 155, + 155, // 154, // 153, // 152 NA |