diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-12-15 14:49:34 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-12-15 14:49:34 +0100 |
commit | 37e3edce200c5a0ae8f81ca729b18d75477d2725 (patch) | |
tree | 02fd172196927cfed25df48691b9a7882976e5a9 /src | |
parent | 471f65813592238509923f2c8748df5be03513e9 (diff) | |
download | vim-git-37e3edce200c5a0ae8f81ca729b18d75477d2725.tar.gz |
patch 8.1.0593: illegal memory access in libvterm testv8.1.0593
Problem: Illegal memory access in libvterm test.
Solution: Fix off-by-one error.
Diffstat (limited to 'src')
-rw-r--r-- | src/libvterm/Makefile | 3 | ||||
-rw-r--r-- | src/libvterm/src/vterm.c | 4 | ||||
-rw-r--r-- | src/libvterm/t/run-test.pl | 2 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 8 insertions, 3 deletions
diff --git a/src/libvterm/Makefile b/src/libvterm/Makefile index 6eacab766..179ee10d7 100644 --- a/src/libvterm/Makefile +++ b/src/libvterm/Makefile @@ -52,6 +52,9 @@ INCDIR=$(PREFIX)/include MANDIR=$(PREFIX)/share/man MAN3DIR=$(MANDIR)/man3 +# Uncomment to check for memory access errors with valgrind. +# VALGRIND=1 + all: $(LIBRARY) $(BINFILES) $(LIBRARY): $(OBJECTS) diff --git a/src/libvterm/src/vterm.c b/src/libvterm/src/vterm.c index 28613b9b0..9025da444 100644 --- a/src/libvterm/src/vterm.c +++ b/src/libvterm/src/vterm.c @@ -169,9 +169,9 @@ INTERNAL void vterm_push_output_vsprintf(VTerm *vt, const char *format, va_list #else written = vsprintf(buffer, format, args); - if(written >= (int)(vt->outbuffer_len - vt->outbuffer_cur)) { + if(written >= (int)(vt->outbuffer_len - vt->outbuffer_cur - 1)) { /* output was truncated */ - written = vt->outbuffer_len - vt->outbuffer_cur; + written = vt->outbuffer_len - vt->outbuffer_cur - 1; } if (written > 0) { diff --git a/src/libvterm/t/run-test.pl b/src/libvterm/t/run-test.pl index 4ef0f26d4..12e11801b 100644 --- a/src/libvterm/t/run-test.pl +++ b/src/libvterm/t/run-test.pl @@ -16,7 +16,7 @@ my ( $hin, $hout, $hpid ); { local $ENV{LD_LIBRARY_PATH} = ".libs"; my @command = "t/.libs/harness"; - unshift @command, "valgrind", "--quiet", "--error-exitcode=126" if $VALGRIND; + 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 - $!"; } diff --git a/src/version.c b/src/version.c index 4e79d28a2..b1de233f9 100644 --- a/src/version.c +++ b/src/version.c @@ -800,6 +800,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 593, +/**/ 592, /**/ 591, |