To: vim_dev@googlegroups.com Subject: Patch 8.1.2340 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2340 Problem: Quickfix test fails under valgrind and asan. Solution: Make sure long line does not overflow IObuff. (Dominique Pelle, closes #5263) Put back fix for large terminals. (Yegappan Lakshmanan, closes #5264) Files: src/quickfix.c, src/testdir/test_quickfix.vim *** ../vim-8.1.2339/src/quickfix.c 2019-11-18 22:02:12.808155010 +0100 --- src/quickfix.c 2019-11-24 21:49:54.113014968 +0100 *************** *** 4416,4422 **** if (qfp->qf_module != NULL) { ! STRCPY(IObuff, qfp->qf_module); len = (int)STRLEN(IObuff); } else if (qfp->qf_fnum != 0 --- 4416,4422 ---- if (qfp->qf_module != NULL) { ! vim_strncpy(IObuff, qfp->qf_module, IOSIZE - 1); len = (int)STRLEN(IObuff); } else if (qfp->qf_fnum != 0 *************** *** 4424,4430 **** && errbuf->b_fname != NULL) { if (qfp->qf_type == 1) // :helpgrep ! STRCPY(IObuff, gettail(errbuf->b_fname)); else { // shorten the file name if not done already --- 4424,4430 ---- && errbuf->b_fname != NULL) { if (qfp->qf_type == 1) // :helpgrep ! vim_strncpy(IObuff, gettail(errbuf->b_fname), IOSIZE - 1); else { // shorten the file name if not done already *************** *** 4435,4460 **** mch_dirname(dirname, MAXPATHL); shorten_buf_fname(errbuf, dirname, FALSE); } ! STRCPY(IObuff, errbuf->b_fname); } len = (int)STRLEN(IObuff); } else len = 0; ! IObuff[len++] = '|'; if (qfp->qf_lnum > 0) { ! sprintf((char *)IObuff + len, "%ld", qfp->qf_lnum); len += (int)STRLEN(IObuff + len); if (qfp->qf_col > 0) { ! sprintf((char *)IObuff + len, " col %d", qfp->qf_col); len += (int)STRLEN(IObuff + len); } ! sprintf((char *)IObuff + len, "%s", (char *)qf_types(qfp->qf_type, qfp->qf_nr)); len += (int)STRLEN(IObuff + len); } --- 4435,4463 ---- mch_dirname(dirname, MAXPATHL); shorten_buf_fname(errbuf, dirname, FALSE); } ! vim_strncpy(IObuff, errbuf->b_fname, IOSIZE - 1); } len = (int)STRLEN(IObuff); } else len = 0; ! ! if (len < IOSIZE - 1) ! IObuff[len++] = '|'; if (qfp->qf_lnum > 0) { ! vim_snprintf((char *)IObuff + len, IOSIZE - len, "%ld", qfp->qf_lnum); len += (int)STRLEN(IObuff + len); if (qfp->qf_col > 0) { ! vim_snprintf((char *)IObuff + len, IOSIZE - len, ! " col %d", qfp->qf_col); len += (int)STRLEN(IObuff + len); } ! vim_snprintf((char *)IObuff + len, IOSIZE - len, "%s", (char *)qf_types(qfp->qf_type, qfp->qf_nr)); len += (int)STRLEN(IObuff + len); } *************** *** 4463,4470 **** qf_fmt_text(qfp->qf_pattern, IObuff + len, IOSIZE - len); len += (int)STRLEN(IObuff + len); } ! IObuff[len++] = '|'; ! IObuff[len++] = ' '; // Remove newlines and leading whitespace from the text. // For an unrecognized line keep the indent, the compiler may --- 4466,4476 ---- qf_fmt_text(qfp->qf_pattern, IObuff + len, IOSIZE - len); len += (int)STRLEN(IObuff + len); } ! if (len < IOSIZE - 2) ! { ! IObuff[len++] = '|'; ! IObuff[len++] = ' '; ! } // Remove newlines and leading whitespace from the text. // For an unrecognized line keep the indent, the compiler may *** ../vim-8.1.2339/src/testdir/test_quickfix.vim 2019-11-24 12:08:01.113774226 +0100 --- src/testdir/test_quickfix.vim 2019-11-24 21:52:02.276381736 +0100 *************** *** 626,635 **** let w3 = win_getid() call assert_true(&buftype == 'help') call assert_true(winnr() == 1) ! call win_gotoid(w1) ! call assert_equal(w3, win_getid(winnr('k'))) ! call win_gotoid(w2) ! call assert_equal(w3, win_getid(winnr('k'))) new | only set buftype=help --- 626,640 ---- let w3 = win_getid() call assert_true(&buftype == 'help') call assert_true(winnr() == 1) ! " See jump_to_help_window() for details ! let w2_width = winwidth(w2) ! if w2_width != &columns && w2_width < 80 ! call assert_equal(['col', [['leaf', w3], ! \ ['row', [['leaf', w2], ['leaf', w1]]]]], winlayout()) ! else ! call assert_equal(['row', [['col', [['leaf', w3], ['leaf', w2]]], ! \ ['leaf', w1]]] , winlayout()) ! endif new | only set buftype=help *** ../vim-8.1.2339/src/version.c 2019-11-24 12:08:01.117774201 +0100 --- src/version.c 2019-11-24 21:35:35.072988727 +0100 *************** *** 739,740 **** --- 739,742 ---- { /* Add new patch number below this line */ + /**/ + 2340, /**/ -- Amnesia is one of my favorite words, but I forgot what it means. /// Bram Moolenaar -- Bram@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 ///