From 22e9aadc887326019839b469c034d8ef148eaabc Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 1 Sep 2020 07:25:36 -0400 Subject: vim-patch:8.2.1554: crash in normal test Problem: Crash in normal test. Solution: Skip adjusting marks if there are no folds. https://github.com/vim/vim/commit/07e87e9eb5e7195d47d47c0ca752b6c8372a99ea --- src/nvim/fold.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/nvim/fold.c b/src/nvim/fold.c index 61a85171e8..2cbe43d5be 100644 --- a/src/nvim/fold.c +++ b/src/nvim/fold.c @@ -1389,6 +1389,10 @@ static void foldMarkAdjustRecurse( linenr_T last; linenr_T top; + if (gap->ga_len == 0) { + return; + } + /* In Insert mode an inserted line at the top of a fold is considered part * of the fold, otherwise it isn't. */ if ((State & INSERT) && amount == (linenr_T)1 && line2 == MAXLNUM) -- cgit From cc64f2cc1dc90c6e2bc24ea1b72c2947fe701549 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 1 Sep 2020 21:02:54 -0400 Subject: vim-patch:8.2.1561: using NULL pointers in fold code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Using NULL pointers in fold code. Solution: Avoid using a NULL pointer. (Dominique Pellé, closes vim/vim#6831, closes vim/vim#6831) https://github.com/vim/vim/commit/81fcb67fb32a12414512b72e691a1bbbff9f8511 --- src/nvim/fold.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/fold.c b/src/nvim/fold.c index 2cbe43d5be..697d283cca 100644 --- a/src/nvim/fold.c +++ b/src/nvim/fold.c @@ -2742,7 +2742,8 @@ static void truncate_fold(win_T *const wp, fold_T *fp, linenr_T end) } #define FOLD_END(fp) ((fp)->fd_top + (fp)->fd_len - 1) -#define VALID_FOLD(fp, gap) ((fp) < ((fold_T *)(gap)->ga_data + (gap)->ga_len)) +#define VALID_FOLD(fp, gap) \ + ((gap)->ga_len > 0 && (fp) < ((fold_T *)(gap)->ga_data + (gap)->ga_len)) #define FOLD_INDEX(fp, gap) ((size_t)(fp - ((fold_T *)(gap)->ga_data))) void foldMoveRange( win_T *const wp, garray_T *gap, -- cgit From 4bcca0baa9a1100104935868ffc57e14d168deed Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 2 Sep 2020 09:00:04 -0400 Subject: vim-patch:8.2.1565: spellfile test sometimes fails Problem: Spellfile test sometimes fails. Solution: Check running into the end of the file. https://github.com/vim/vim/commit/e90d63ea904187ecbb09d0f7f21b71b302b30644 --- src/nvim/spellfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index a7d26e2a8e..c2212cf767 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -3038,9 +3038,9 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile) spin->si_msg_count = 999999; // Read and ignore the first line: word count. - (void)vim_fgets(line, MAXLINELEN, fd); - if (!ascii_isdigit(*skipwhite(line))) + if (vim_fgets(line, MAXLINELEN, fd) || !ascii_isdigit(*skipwhite(line))) { EMSG2(_("E760: No word count in %s"), fname); + } // Read all the lines in the file one by one. // The words are converted to 'encoding' here, before being added to -- cgit From b9430fe28ef8c5a865b3bee5c7f523abc3b1947a Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 2 Sep 2020 20:49:12 -0400 Subject: vim-patch:8.2.1566: not all Bazel files are recognized Problem: Not all Bazel files are recognized. Solution: Add *.bazel and *.BUILD. (closes vim/vim#6836) https://github.com/vim/vim/commit/4488f5a545691ca4c8802bad0d70a5e750fc8844 --- src/nvim/testdir/test_filetype.vim | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index 529f237a97..617e3dfe41 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -75,6 +75,7 @@ let s:filename_checks = { \ 'ave': ['file.ave'], \ 'awk': ['file.awk', 'file.gawk'], \ 'b': ['file.mch', 'file.ref', 'file.imp'], + \ 'bzl': ['file.bazel', 'file.bzl', 'WORKSPACE'], \ 'bc': ['file.bc'], \ 'bdf': ['file.bdf'], \ 'bib': ['file.bib'], @@ -526,6 +527,7 @@ let s:filename_checks = { let s:filename_case_checks = { \ 'modula2': ['file.DEF', 'file.MOD'], + \ 'bzl': ['file.BUILD', 'BUILD'], \ } func CheckItems(checks) -- cgit From 5fcdb630253b8d71fd30a2259f72aeb27e1676e0 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 2 Sep 2020 22:22:15 -0400 Subject: vim-patch:8.2.1564: a few remaining errors from ubsan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: A few remaining errors from ubsan. Solution: Avoid the warnings. (Dominique Pellé, closes vim/vim#6837) https://github.com/vim/vim/commit/4ad739fc053c1666d07ba1cf59be26cb1c3e52d7 --- src/nvim/spell.c | 4 ++-- src/nvim/spellfile.c | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 95948dac78..ad235f1f14 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -5765,14 +5765,14 @@ cleanup_suggestions ( ) FUNC_ATTR_NONNULL_ALL { - suggest_T *stp = &SUG(*gap, 0); - if (gap->ga_len > 0) { // Sort the list. qsort(gap->ga_data, (size_t)gap->ga_len, sizeof(suggest_T), sug_compare); // Truncate the list to the number of suggestions that will be displayed. if (gap->ga_len > keep) { + suggest_T *const stp = &SUG(*gap, 0); + for (int i = keep; i < gap->ga_len; i++) { xfree(stp[i].st_word); } diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index c2212cf767..09d8646c6d 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -984,15 +984,17 @@ nextone: static char_u *read_cnt_string(FILE *fd, int cnt_bytes, int *cntp) { int cnt = 0; - int i; char_u *str; // read the length bytes, MSB first - for (i = 0; i < cnt_bytes; ++i) - cnt = (cnt << 8) + getc(fd); - if (cnt < 0) { - *cntp = SP_TRUNCERROR; - return NULL; + for (int i = 0; i < cnt_bytes; i++) { + const int c = getc(fd); + + if (c == EOF) { + *cntp = SP_TRUNCERROR; + return NULL; + } + cnt = (cnt << 8) + (unsigned)c; } *cntp = cnt; if (cnt == 0) -- cgit