Patch 8.2.1564

5 views
Skip to first unread message

Bram Moolenaar

unread,
Sep 2, 2020, 4:26:47 AM9/2/20
to vim...@googlegroups.com

Patch 8.2.1564
Problem: A few remaining errors from ubsan.
Solution: Avoid the warnings. (Dominique Pellé, closes #6837)
Files: src/spellfile.c, src/spellsuggest.c, src/viminfo.c


*** ../vim-8.2.1563/src/spellfile.c 2020-09-01 19:56:10.928571016 +0200
--- src/spellfile.c 2020-09-02 10:23:42.083847277 +0200
***************
*** 816,826 ****

// read the length bytes, MSB first
for (i = 0; i < cnt_bytes; ++i)
- cnt = (cnt << 8) + (unsigned)getc(fd);
- if (cnt < 0)
{
! *cntp = SP_TRUNCERROR;
! return NULL;
}
*cntp = cnt;
if (cnt == 0)
--- 816,830 ----

// read the length bytes, MSB first
for (i = 0; i < cnt_bytes; ++i)
{
! int c = getc(fd);
!
! if (c == EOF)
! {
! *cntp = SP_TRUNCERROR;
! return NULL;
! }
! cnt = (cnt << 8) + (unsigned)c;
}
*cntp = cnt;
if (cnt == 0)
*** ../vim-8.2.1563/src/spellsuggest.c 2020-09-01 19:56:10.928571016 +0200
--- src/spellsuggest.c 2020-09-02 10:21:12.184360499 +0200
***************
*** 3731,3739 ****
int maxscore,
int keep) // nr of suggestions to keep
{
- suggest_T *stp = &SUG(*gap, 0);
- int i;
-
if (gap->ga_len > 0)
{
// Sort the list.
--- 3731,3736 ----
***************
*** 3744,3749 ****
--- 3741,3749 ----
// displayed.
if (gap->ga_len > keep)
{
+ int i;
+ suggest_T *stp = &SUG(*gap, 0);
+
for (i = keep; i < gap->ga_len; ++i)
vim_free(stp[i].st_word);
gap->ga_len = keep;
*** ../vim-8.2.1563/src/viminfo.c 2020-08-01 16:08:14.805278012 +0200
--- src/viminfo.c 2020-09-02 10:21:12.184360499 +0200
***************
*** 2183,2189 ****
xfmark_T *vi_fm;

fm = idx >= 0 ? &curwin->w_jumplist[idx] : NULL;
! vi_fm = vi_idx < vi_jumplist_len ? &vi_jumplist[vi_idx] : NULL;
if (fm == NULL && vi_fm == NULL)
break;
if (fm == NULL || (vi_fm != NULL && fm->time_set < vi_fm->time_set))
--- 2183,2190 ----
xfmark_T *vi_fm;

fm = idx >= 0 ? &curwin->w_jumplist[idx] : NULL;
! vi_fm = (vi_jumplist != NULL && vi_idx < vi_jumplist_len)
! ? &vi_jumplist[vi_idx] : NULL;
if (fm == NULL && vi_fm == NULL)
break;
if (fm == NULL || (vi_fm != NULL && fm->time_set < vi_fm->time_set))
*** ../vim-8.2.1563/src/version.c 2020-09-01 23:16:27.451424408 +0200
--- src/version.c 2020-09-02 10:22:24.588112669 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1564,
/**/

--
** Hello and Welcome to the Psychiatric Hotline **
If you are obsessive-compulsive, please press 1 repeatedly.
If you are co-dependent, please ask someone to press 2.
If you have multiple personalities, please press 3, 4, 5 and 6.
If you are paranoid-delusional, we know who you are and what you want
- just stay on the line so we can trace the call.
If you are schizophrenic, listen carefully and a little voice will
tell you which number to press next.
If you are manic-depressive, it doesn't matter which number you press
- no one will answer.
If you suffer from panic attacks, push every button you can find.
If you are sane, please hold on - we have the rest of humanity on the
other line and they desparately want to ask you a few questions.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages