To: vim_dev@googlegroups.com Subject: Patch 8.1.0593 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0593 Problem: Illegal memory access in libvterm test. Solution: Fix off-by-one error. Files: src/libvterm/src/vterm.c, src/libvterm/Makefile, src/libvterm/t/run-test.pl *** ../vim-8.1.0592/src/libvterm/src/vterm.c 2018-04-24 18:23:45.000000000 +0200 --- src/libvterm/src/vterm.c 2018-12-15 14:43:48.466327193 +0100 *************** *** 169,177 **** #else written = vsprintf(buffer, format, args); ! if(written >= (int)(vt->outbuffer_len - vt->outbuffer_cur)) { /* output was truncated */ ! written = vt->outbuffer_len - vt->outbuffer_cur; } if (written > 0) { --- 169,177 ---- #else written = vsprintf(buffer, format, args); ! if(written >= (int)(vt->outbuffer_len - vt->outbuffer_cur - 1)) { /* output was truncated */ ! written = vt->outbuffer_len - vt->outbuffer_cur - 1; } if (written > 0) { *** ../vim-8.1.0592/src/libvterm/Makefile 2018-12-15 14:24:34.293210452 +0100 --- src/libvterm/Makefile 2018-12-15 14:46:36.649289986 +0100 *************** *** 52,57 **** --- 52,60 ---- MANDIR=$(PREFIX)/share/man MAN3DIR=$(MANDIR)/man3 + # Uncomment to check for memory access errors with valgrind. + # VALGRIND=1 + all: $(LIBRARY) $(BINFILES) $(LIBRARY): $(OBJECTS) *** ../vim-8.1.0592/src/libvterm/t/run-test.pl 2017-06-24 16:44:02.000000000 +0200 --- src/libvterm/t/run-test.pl 2018-12-15 14:38:07.328417529 +0100 *************** *** 16,22 **** { local $ENV{LD_LIBRARY_PATH} = ".libs"; my @command = "t/.libs/harness"; ! unshift @command, "valgrind", "--quiet", "--error-exitcode=126" if $VALGRIND; $hpid = open2 $hout, $hin, @command or die "Cannot open2 harness - $!"; } --- 16,22 ---- { local $ENV{LD_LIBRARY_PATH} = ".libs"; my @command = "t/.libs/harness"; ! unshift @command, "valgrind", "--tool=memcheck", "--leak-check=yes", "--num-callers=25", "--log-file=valgrind.out", "--error-exitcode=126" if $VALGRIND; $hpid = open2 $hout, $hin, @command or die "Cannot open2 harness - $!"; } *** ../vim-8.1.0592/src/version.c 2018-12-15 14:24:34.293210452 +0100 --- src/version.c 2018-12-15 14:45:09.285829163 +0100 *************** *** 801,802 **** --- 801,804 ---- { /* Add new patch number below this line */ + /**/ + 593, /**/ -- The Feynman problem solving Algorithm: 1) Write down the problem 2) Think real hard 3) Write down the answer /// 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 ///